#C5775. Maximum Directory Depth
Maximum Directory Depth
Maximum Directory Depth
Given a set of directory names representing nested directory structures, determine the maximum directory depth. Each directory name is a string in which nested subdirectories are separated by a dot ('.'). The depth of a directory is computed as:
\(depth = n + 1\)
where \(n\) is the number of dots in the directory name. For example, a directory name without any dots has a depth of 1.
Your task is to compute the maximum depth among the given directory names.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \(N\) representing the number of directory names.
- The next \(N\) lines each contain a non-empty string representing a directory name. Each directory name may contain dots ('.') as separators.
outputFormat
Output a single integer to standard output (stdout) representing the maximum directory depth found among the \(N\) directory names.
## sample4
home.username.documents
home.username.pictures.vacation
home.music
var.log
4