Pagini recente » Cod sursa (job #3272226) | Cod sursa (job #2745297) | Cod sursa (job #1978934) | Cod sursa (job #755954) | Cod sursa (job #2660996)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("abc2.in");
ofstream fout("abc2.out");
unordered_map<string, int> h;
string cuv[22];
int len;
int main()
{
string s, txt;
fin >> s;
while(fin >> txt)
cuv[++len] = txt;
// for(int i = 1; i <= len; i++)
// cout << cuv[i] << " ";
int lgmax = cuv[1].size();
for(int i = 0, j = i + lgmax; i + lgmax < s.size(); i++)
{
string w = s.substr(i, j);
h[w]++;
}
int nrs = 0;
for(int i = 1; i <= len; i++)
if(h[cuv[i]] > 0)
{
nrs++;
h[cuv[i]] = 0;
}
fout << nrs;
return 0;
}