View Code of Problem 3693

#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<string>
#include<cmath>
#include<unordered_map>
#include<stack>

using namespace std;


int main()
{
	int n;
	while (cin >> n) {

		getchar();
		vector<string> strs(n);

		for (int i = 0; i < n; i++)
			getline(cin, strs[i]);

		string word;
		getline(cin, word);

		int sum = 0;
		for (int i = 0; i < n; i++) {

			int pos = 0;
			while (word.find(strs[i], pos) != word.npos) {

				sum++;
				pos = word.find(strs[i], pos) + strs[i].size();
			}
		}

		cout << sum << endl;
	}
}

Double click to view unformatted code.


Back to problem 3693