0
Seems to me you simply need the index of "Bob" under the condition that "cool" appears someplace after "Bob" within the same string.
You could get the index of "Bob" and "cool" separately. Test if they both appear and if the index of "cool" is greater than the index of "Bob." If true, then the index of "Bob" is your answer.