String sort(challenge)

how to check for the suffix part in a string for comparison?

hello @poojadas408
u mean prefix right ?

just start iterating both the strings .break the loop where first mismatch happen.

if loop iterator value is equal to the one of the size of string then one string is prefix of other .
otherwise not

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

hi @poojadas408 you can use the string.find() method to check if a string is present in another string or not. http://www.cplusplus.com/reference/string/string/find/

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.