Pagini recente » Cod sursa (job #2616252) | Cod sursa (job #2336691) | Cod sursa (job #1114517) | Cod sursa (job #3159919) | Cod sursa (job #2297031)
#include <fstream>
#include <string>
#include <cstring>
#include <set>
using namespace std;
ifstream in("abc2.in");
ofstream out("abc2.out");
int cnt, n, len, ans;
char ch[10000001];
string cuv;
set<string> dictionary;
int main()
{
in >> ch;
while(!in.eof())
in >> cuv, dictionary.insert(cuv);
n = cuv.length();
len = strlen(ch);
for(int i = 0; i < len - n + 1; i++)
{
char temp[21] = {'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
for(int j = 0; j < n; j++)
temp[j] = ch[i+j];
string str(temp);
ans += dictionary.count(str);
}
out << ans;
return 0;
}