INPUT format leading to error

As the input has spaces in them so the two user input strings are not able to differentiate the strings in the input.
Code is working fine for custom input.
Refer for code: -

@ambuj_0909
please use getline(), for taking input.