Pagini recente » Cod sursa (job #1680246) | Cod sursa (job #1143564) | Cod sursa (job #2496614) | Cod sursa (job #3253957) | Cod sursa (job #2293953)
#include <bits/stdc++.h>
using namespace std;
char s[10000001], vocabular[50001], ch[50001], aux[10000001];
int main()
{
ifstream f("abc2.in");
ofstream g("abc2.out");
unordered_map<string, int > mp;
int l, nr = 0;
f>>s;
strcpy(aux, s);
while(f>>vocabular)
{
mp[vocabular] = 1;
l = strlen(vocabular);
}
int ll = strlen(s) ;
int LL = ll;
for (int i = 1; i <= (ll - 1) / (l - 1); i++)
{
strcpy(aux, s);
strcpy(aux + l, aux + LL);
strcpy(ch,aux);
if(mp.find(ch) != mp.end()) nr++;
strcpy(s, s + 1);
LL--;
}
g<<nr;
return 0;
}