Cod sursa(job #2077161)
Utilizator | Isac Lucian IsacLucian | Data | 27 noiembrie 2017 19:35:20 |
---|---|---|---|
Problema | Abc2 | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("abc2.in");
ofstream fout("abc2.out");
char a[10000002],aux[22],b[22];
map<string, int >umap;
int main()
{
int i,n,m,sol;
fin>>a;
m=strlen(a);
fin.get();
fin>>b;
n=strlen(b);
fin.get();
for(i=0;i<m-n;i++)
{
strncpy(aux,a+i,n);
umap[aux]++;
}
sol=0;
if(umap[b]>0)
{
sol=umap[b];
umap[b]=0;
}
while(fin>>b)
{
sol+=umap[b];
umap[b]=0;
fin.get();
}
fout<<sol;
return 0;
}