Solution giving TLE

I have written solution for this easy problem and the code is also very simple, but I don’t know why it is giving TLE, please help me out🥺
Problem : Contest Page | CodeChef
My Solution : Solution: 54780686 | CodeChef

1 Like

Do the following changes and try again.

  • Use fast IO
  • Use '\n' instead of endl

Edit: You should pass the string as a reference.

Solution: 54788590 | CodeChef (Focus on the & on the line 90)

3 Likes

Thank you soooo muchhh​:star_struck::grinning_face_with_smiling_eyes:…I didn’t knew passing the copy of string takes much time​:sweat_smile:… Thank you…

1 Like