Pagini recente » Cod sursa (job #68160) | Cod sursa (job #2951508) | Cod sursa (job #3030523) | Cod sursa (job #521026) | Cod sursa (job #3266332)
#include <bits/stdc++.h>
using namespace std;
string text, word;
map<deque<char>, bool> m;
int main() {
ifstream cin("abc2.in");
ofstream cout("abc2.out");
cin >> text;
while (cin >> word) {
deque<char> dq;
for (int i = 0; i < word.size(); ++i) {
dq.push_back(word[i]);
}
m[dq] = true;
}
int ans = 0;
deque<char> dq;
for (int i = 0; i < text.size(); ++i) {
dq.push_back(text[i]);
if (dq.size() == word.size()) {
ans += m[dq];
dq.pop_front();
}
}
cout << ans;
}