If you mean the error message is
IndexError: string index out of range
Then it's pretty simple, but it depends on your inputs.
if you enter "abcd" for your first string, and "?" as your second (or just "a") then the second time round the inner loop it tries to access the second character of the second string, which doesn't exist and you get an error.
Add a check before the loop which makes sure that both strings are the same length and it'll go away.
BTW: you could have found this very easily for yourself by using the debugger to see exactly what is happening when your code runs ... get used to the debugger, it can save you loads and loads of hair pulling wasted time!