This code works, but does not work for this example:

string1 = " rry"
string2 = " yoh"

result is string3 =" rryoh"

The result should be ryoh, not rryoh. This code does not check different letters from first string, just for second.

Can you help me how to solve that?