Loading...
Khokran avatar Khokran 0 Точки

Задача: 01.Dictionary

Здравейте колеги, стигнах до някъде, но се оплетох, може ли малко помощ?

Задача:  https://pastebin.com/5pXF2XAR

 

 

Условие:  

01. Dictionary

Your task is to take every word and insert it into the dictionary with its definition. A word may have one or more definitions. You will receive all the words and definitions, separated by " | ", and each word and its definition will be separated by ": ".

After this you will have to check the words you have in the dictionary. Now you will receive only words, again separated by " | ". For each word you get you will have to print it and all of its definitions, ordered by length of the definition in descending order (if it exists in the dictionary) in the following format:

"{word}:"

" –{definition1}"

" –{definition2}"

" –{definition3}"

. . .

In the end, you will receive one more command, which will be either "End" or "List". If the command is "End", you should break the program. If the command is "List", you should print all of the words, ordered alphabetically, separated by space (" ").

Input

Three strings. The first one will have pairs of words and descriptions, separated by " | " and each word separated from its description by ": ". The second string will have only words, separated by " | ". The third string will be a command – either "End" or "List".

Output

For each word that is called you have to print it with all of its definitions ordered by their length (descending). In the end you have to print all the words, ordered alphabetically, separated by a single space if you have the command "List".  For all of the words you have to print them in the format:

"{word}:"

" –{definition1}"

" –{definition2}"

" –{definition3}"

. . .

Examples

Input

programmer: an animal, which turns coffee into code | developer: a magician

Pesho | Gosho

List

Output

developer programmer

 

Input

tackle: the equipment required for a task or sport | code: write code for a computer program | bit: a small piece, part, or quantity of something | tackle: make determined efforts to deal with a problem | bit: a short time or distance

bit | code | tackle

End

Output

bit

 -a small piece, part, or quantity of something

 -a short time or distance

code

 -write code for a computer program

tackle

 -make determined efforts to deal with a problem

 -the equipment required for a task or sport

 

Тагове:
0
Fundamentals Module
JulianJulianov avatar JulianJulianov 9 Точки

Здравейте! И мен доста ме обърка тази задача. Забелязах , че в условието й никъде не е упоменато, че думите трябва да са подредени по азбучен ред, а чак във втората таблица с изходите  разгадавам това. А излишното "End" създава само тотално объркване у хората. Явно това е капанчето в тази задача. https://pastebin.com/9Y6AAWd1

0
28/06/2020 23:53:12
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.