#P1738. 洛谷的文件夹
洛谷的文件夹
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: means that under the root directory there is a folder named , inside which there is a folder named , and inside that there is a folder named .
In each path, the -st character is always , there are no two consecutive characters, and the last character is not . 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 -st line contains a positive integer .
The next lines each contain a string describing a path, with length no more than .
Output Format
The output should contain lines, each with a single positive integer. On the -th line, output the minimum number of folders that need to be created so that the first through 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 of the testdata, .
- For of the testdata, .
- Additionally, for of the testdata, every path contains at most two characters (counting the first character).
- For all testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号