I travel from leaves to root and used KMP to find string pattern in my program.
When I used cin in line 46 I get expected output
But since it is clearly mentioned in question using cin will give TLE I get 4 TLE in 2nd Subtask
Solution Link: https://www.codechef.com/viewsolution/13891213
So I used scanf instead of cin in line 45 but I get runtime error or all zeros in output
Problem Link : https://www.codechef.com/LOCMAY17/problems/VTREE