Time limit: 1 second Memory limit: 256 MB You are on the computer desktop and there is…
- User
Time limit: 1 second Memory limit: 256 MB You are on the computer desktop and there is nothing on the desktop. We want you to handle two types of events.
A folder called n a m e Create the name given to you as a string. Print the names of all folders in order (taking into account the lexical order of the strings). Note that if there is a repeated name in the entry, write the same name but add the number in parentheses.
input In the first line, enter a natural number n n is shown to indicate the number of folders. in n The next n line in each line contains the name of a folder.
1 ≤ n ≤ 1000 1≤n≤1000 1 ≤ ∣ n a m e i ∣ ≤ 50 1≤∣name i ∣≤50
output For each folder you create, print a list of all current folders (along with the created folder) in one line. Enclose the name of each folder in double single quotes and separate these names with a comma and a space.
Example Sample entry 1 4 New Folder Contest Contest Contest Plain text Sample output 1 'New Folder' 'Contest', 'New Folder' 'Contest', 'Contest (1)', 'New Folder' 'Contest', 'Contest (1)', 'Contest (2)', 'New Folder' Plain text Sample input 2 3 Contest Contest Contest (1) Plain text Sample output 2 'contest' 'Contest', 'Contest (1)' 'Contest', 'Contest (1)', 'Contest (1) (1)' Plain text Sample entry 3 11 A A A A A A A A A A A Plain text Sample output 3 'A' 'A', 'A (1)' 'A', 'A (1)', 'A (2)' 'A', 'A (1)', 'A (2)', 'A (3)' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)', 'A (5)' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)', 'A (5)', 'A (6)' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)', 'A (5)', 'A (6)', 'A (7) )' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)', 'A (5)', 'A (6)', 'A (7) )', 'A (8)' 'A', 'A (1)', 'A (2)', 'A (3)', 'A (4)', 'A (5)', 'A (6)', 'A (7) )', 'A (8)', 'A (9)' 'A', 'A (1)', 'A (10)', 'A (2)', 'A (3)', 'A (4)', 'A (5)', 'A (6) )', 'A (7)', 'A (8)', 'A (9)' write in java
- Assistantjava