102612: [AtCoder]ABC261 C - NewFolder(1)
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:4
Solved:0
Description
Score : $300$ points
Problem Statement
For two strings $A$ and $B$, let $A+B$ denote the concatenation of $A$ and $B$ in this order.
You are given $N$ strings $S_1,\ldots,S_N$. Modify and print them as follows, in the order $i=1, \ldots, N$:
- if none of $S_1,\ldots,S_{i-1}$ is equal to $S_i$, print $S_i$;
- if $X$ $(X>0)$ of $S_1,\ldots,S_{i-1}$ are equal to $S_i$, print $S_i+$
(
$+X+$)
, treating $X$ as a string.
Constraints
- $1 \leq N \leq 2\times 10^5$
- $S_i$ is a string of length between $1$ and $10$ (inclusive) consisting of lowercase English letters.
Input
Input is given from Standard Input in the following format:
$N$ $S_1$ $S_2$ $\vdots$ $S_N$
Output
Print $N$ 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)
Input
题意翻译
对于两个字符串 A 和 B ,A + B 表示将 A 与 B 的字符顺次连接。 现在给予 N 个字符串 , $ S_{1}\sim S_{N} $ 。对于 $S_{i}$ 修改并输出如下, $i$ 属于 $1\sim N$ : - 如果在 $S_{1}\sim S_{i-1}$ 中没有一个与 $S_{i}$ 相同 ,输出 $S_{i}$ 。 - 如果在 $S_{1}\sim S_{i-1}$ 中有 $X(X>0)$ 个字符串与 $S_{i}$ 相同,输出 $S_{i}$ + $($ + $X$ + $)$ ,将 $X$ 视为字符串。Output
分数:300分
问题描述
给定两个字符串$A$和$B$,令$A+B$表示按照这个顺序连接$A$和$B$。
给你$N$个字符串$S_1,\ldots,S_N$。按照如下方式修改并打印它们,按照顺序$i=1, \ldots, N$:
- 如果$S_1,\ldots,S_{i-1}$中没有一个等于$S_i$,打印$S_i$;
- 如果$X$ $(X>0)$个$S_1,\ldots,S_{i-1}$等于$S_i$,打印$S_i+$
(
$+X+$)
,将$X$视为字符串。
限制条件
- $1 \leq N \leq 2\times 10^5$
- $S_i$是一个长度在$1$到$10$(含)之间的由小写英文字母组成的字符串。
输入
输入从标准输入给出,格式如下:
$N$ $S_1$ $S_2$ $\vdots$ $S_N$
输出
按照问题描述中所述打印$N$行。
样例输入1
5 newfile newfile newfolder newfile newfolder
样例输出1
newfile newfile(1) newfolder newfile(2) newfolder(1)
样例输入2
11 a a a a a a a a a a a
样例输出2
a a(1) a(2) a(3) a(4) a(5) a(6) a(7) a(8) a(9) a(10)