SP13384 NICEBTRE - Nice Binary Trees
Description
For example, the following tree is nice,
Input Format
The first line contains the number of test cases T. T lines follow. Each line contains a string, which represents the pre-order traversal of a “nice” binary tree. Leaves are represented by the letter ‘l’ and other nodes by the letter ‘n’. The input is guaranteed to be the preorder traversal of a nice binary tree.
Output Format
Output one line for each test case, containing a single integer, the depth of tree.