LearnPy Hub
← Arena
IntermediateRating 1200

Height of a Binary Tree

A binary tree is given level by level, with N for an empty spot. Print the number of nodes on the longest path from the root to a leaf.

Input

One line of values and N.

Output

One integer.

Sample 1

Input
3 9 20 N N 15 7
Output
3

Sample 2

Input
1 N 2
Output
2
solution.py
Output appears here
Height of a Binary Tree · Python Arena problem · LearnPy Hub