String sorting with find function for substring

sir i am unable to understand few things in the code, please tell me. Like find function gives index of first occurrence of a substring in other string , but how it is comparing all characters of substring . otherwise it would check for first similar character then swap for large length first without comparing other characters. Eg :
link -->

It matches the entire subsequence and not just the first character. You can find more information about the find function here:

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.