View Code of Problem 3693

#include <bits/stdc++.h>

using namespace std;


string a[105];
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int k = 0;
	string x;
	cin >> x;
	for (int i = 0; i < n; i++) {
			while (x.find(a[i]) != -1) {
				k++;
				x.erase(x.find(a[i]), a[i].length());
			}
		
		
	}
	cout << k;
	return 0;
}

Double click to view unformatted code.


Back to problem 3693