1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str1, str2;
cout << "string1: ";
getline(cin, str1);
cout << "string2: ";
getline(cin, str2);
int index = str1.find(str2);
if (index == string::npos)
cout << "Not found" << endl;
else
cout << index << endl;
return 0;
}
Enter to Rename, <Shift>+Enter to Preview