why WA in RRFRNDS

link:[“hglhKR - Online C++ Compiler & Debugging Tool - Ideone.com”]
This is the link of my solution
PLZ tell me what’s wrong with my code or a test case for which it i giving wrong ansl
plz help me i and my friends have tried many test cases plz help