Shotgun
Time limit1sMemory limit1024 MB
Given a 4-row keyboard grid and 9 typed characters, find the center key whose 3x3 neighborhood contains exactly those characters.
- Level
Easy2 of 10
- Topics
- Matrix, Brute force, Hash map
- Solved
- No attempts yet
Problem
"Who on earth made this problem!!!"
Guan-woo, a participant of the INU Code Festival who was furious about the problem, slammed his fist on the keyboard and ran out of the venue!
Guan-woo aimed at one specific key and punched the keyboard. The key itself and the eight keys around it (up, down, left, right, and the four diagonals) made nine characters that were typed into a notepad in random order, and the keyboard was smashed to pieces at the same time.
Dong-bin has to repair the keyboard before tomorrow's class. He needs to look at the characters typed into the notepad and work out where Guan-woo punched.
Dong-bin is busy preparing for graduation, so find the position where Guan-woo hit the keyboard for him.
Input
The first to fourth lines each contain 10 characters, one for each key on the keyboard row.
All characters are distinct and have ASCII values from 33 to 126. In other words, every character is printable and none is a control character.
The fifth line contains the string typed into the notepad in random order.
The answer is unique, and exactly 9 characters are guaranteed to be typed.
Output
Print the character of the key where Guan-woo punched the keyboard.