#abc261c. C - NewFolder(1)
C - NewFolder(1)
Score : points
问题描述
对于两个字符串 和 ,令 表示按顺序连接的 和 。
给定 个字符串 。按照从 到 的顺序修改并打印它们:
- 如果 中没有一个等于 ,则打印 ;
- 如果有 ()个 等于 ,则将 视为字符串,打印
(
)
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
For two strings and , let denote the concatenation of and in this order.
You are given strings . Modify and print them as follows, in the order :
- if none of is equal to , print ;
- if of are equal to , print
(
)
, treating as a string.
Constraints
- is a string of length between and (inclusive) consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
Print lines as specified in the Problem Statement.
Sample Input 1
5
newfile
newfile
newfolder
newfile
newfolder
Sample Output 1
newfile
newfile(1)
newfolder
newfile(2)
newfolder(1)
Sample Input 2
11
a
a
a
a
a
a
a
a
a
a
a
Sample Output 2
a
a(1)
a(2)
a(3)
a(4)
a(5)
a(6)
a(7)
a(8)
a(9)
a(10)
update @ 2024/3/10 11:03:38