ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > ProgramHER 2019 > задача:


1. Word Puzzle

ProgramHER 2019

Старт: 03.мар.2019 в 09:59:00
Финиш: 03.мар.2019 в 12:54:00
Турнир завершён!
• Турнирная таблица

Задачи турнира

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

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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