Write a program that will find the first occurance of the given keyword in the given text.
I have it displayed the symbol index and not index words, how to fix?
for example:
input: This is sentences
is
output: 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <string>
usingnamespace std;
int main ()
{
int index=0;
string str;
string key;
getline(cin,str);
getline(cin,key);
index = str.rfind(key);
cout <<index<<endl;
return 0;
}