The && caused return value of -1 despite matching instance of pattern in line, due to && operand checking for both variables inside the nested for loop to return true. The || operand solves this by returning true value if any of two is true.
mstrindex should now return the position of the rightmost occurrence of t in s, that is 11 as desired.
The && caused return value of -1 despite matching instance of pattern in line, due to && operand checking for both variables inside the nested for loop to return true. The || operand solves this by returning true value if any of two is true. mstrindex should now return the position of the rightmost occurrence of t in s, that is 11 as desired.