Getting WA on test 2 of string window

Getting WA on test 2 of string window

Code:

Please Help

Hello @kunal9724kg,

The logic of your code is correct.
But you have missed a very important part of the question which says String2 can be a string containing spaces also.

You are using cin to input second string, which is reading the first word of the string only and causing wrong output.

Solution: Use getline as it accepts spaces also.

Hope, this would help.
Give a like if you are satisfied.