#P1738. 洛谷的文件夹

    ID: 700 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 5 上传者: 标签>模拟字符串树形结构洛谷原创枚举,暴力

洛谷的文件夹

Description

kkksc03 is an extraordinary dreamer! In a short time, he imagined a large number of web pages and always handed them to the poor lzn to implement.

On Luogu’s web frontend, there are many folders, and folders are nested inside folders.

For example: /luogu/application/controller\verb!/luogu/application/controller! means that under the root directory there is a folder named luogu\verb!luogu!, inside which there is a folder named application\verb!application!, and inside that there is a folder named controller\verb!controller!.

In each path, the 11-st character is always /\verb!/!, there are no two consecutive /\verb!/! characters, and the last character is not /\verb!/!. All names contain only digits and lowercase letters.

Currently, the root directory is empty. kkksc03 has thought of many folder pathnames that should exist. The question is: to make all these folders exist, how many folders need to be newly created?

Input Format

The 11-st line contains a positive integer NN.

The next NN lines each contain a string describing a path, with length no more than 100100.

Output Format

The output should contain NN lines, each with a single positive integer. On the ii-th line, output the minimum number of folders that need to be created so that the first 11 through ii paths exist.

2
/luogu/application/controller
/luogu/application/view

3
4

3
/chicken
/chicken/egg
/chicken
1
2
2
4
/a
/a/b
/a/c
/b/b
1
2
3
5

Hint

Constraints

  • For 20%20\% of the testdata, N20N \le 20.
  • For 50%50\% of the testdata, N200N \le 200.
  • Additionally, for 30%30\% of the testdata, every path contains at most two /\verb!/! characters (counting the first character).
  • For all testdata, N1000N \le 1000.

Translated by ChatGPT 5