// Find sub string index's
// By DreamVB 21:34 21/10/2016

#include <iostream>
#include <string>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){

	string s0 = "";
	string s1 = "";
	int pos = string::npos;

	cout << "Enter some text to scan : ";
	std::getline(std::cin, s0);
	cout << "Enter a sub string to find : ";
	cin >> s1;

	do{

		pos = s0.find(s1, pos + 1);

		if (pos != string::npos){
			//Output sub string index.
			cout << s1.c_str() << " was found at index " << pos << endl;
		}

	} while (pos > 0);


	system("pause");
	return 0;
}