I want to find the position (or index) of the last occurrence of a certain substring in given input string str
.
For example, suppose the input string is str = 'hello'
and the substring is target = 'l'
, then it should output 3.
How can I do this?