I am not able to find the above problem on spoj so will you plz provide link for the above problem
Hello @priya_Jain here is the link -> https://www.spoj.com/problems/PRATA/