Izbornik
The menu in a computer program contains N options. Each option is described by one or more words. Each option in the menu, in order from first to last, is assigned a shortcut – one of the letters in its description. The rules for assigning the shortcut are:
• First consider the initial letters of all words in the description, in order from first to last. The first such initial letter not already to another option is selected (no two options may have the same shortcut).
• If all initial letters are already assigned, then consider all remaining letters in the description in order, again choosing the first available letter.
• If none of the letters in the description are available, then the option has no shortcut.
• The process is not case sensitive; lowercase and uppercase letters are considered the same. Write a program which, given the descriptions of all options, determines the shortcuts.
For each option, in the same order in which they were given, output its description with the shortcut letter surrounded by brackets. If an option is not assigned a shortcut, output its description unchanged. The case of all letters must be the same as in the input.
5
New
Open
Save
Save As
Save All output
[N]ew
[O]pen
[S]ave
Save [A]s
Sa[v]e All Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.