HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > ProgramHER 2019 > problem:


1. Word Puzzle

ProgramHER 2019

Start: Mar.03.2019 at 09:59:00 AM
Finish: Mar.03.2019 at 12:54:00 PM
The contest is finished!
• Contest scoreboard

Contest problems

• 1. Word Puzzle
• 2. Trip to Librazhd
• 3. Check-Mate
• 4. Post Office Delivery

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Word Puzzle

On a TV program there is word puzzle game. The competitors are given several words and they are given another word whose letters are scrambled. They are asked to find the word in the shortest time. In order not to have any problem in competition time, the program coordinator is asking a program that verifies the words.

Question: You will be given n words and a word whose letters are scrambled, write a program that will find the correct word. If there are several words with the same letters show the first one. The letters may be uppercase or lowercase, it doesn't make any difference. If both words have the same letters they are assumed to be the same and you don't need to count the spaces. You just check if both words have the same letters or not.

Input specification
You will be given one integer in the beginning, the number of words (n) where 1 ≤ n ≤ 1,000. Then in the second line, you will be given target string which is at most 250 characters containing only 26 English letters and spaces. Then, in the following n lines, you will be given n strings.

Output specification
Show the position of the correct word.

Sample Input I
9
ea lCMbtea
Reshat Tarba
Caleb Meta
Olgers Karini
Xhorxho Uka
Xhoxhina Balukja
Kim Cjapi
Elmedin Dosari
Zhaneta Kruja
Alexander Cox
Sample Output I
2


Для отправки решений необходимо выполнить вход.

www.contester.ru