Cod sursa(job #2262747)
| Utilizator | Data | 17 octombrie 2018 19:44:45 | |
|---|---|---|---|
| Problema | Abc2 | Scor | 0 |
| Compilator | cpp-32 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.62 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("abc2.in");
ofstream fout("abc2.out");
string textAntic;
unordered_map<string, int> M;
int n;
void Citire()
{
fin >> textAntic;
string x;
fin >> x;
int lng = x.length();
M[x]++;
while(fin >> x)
M[x]++;
int cnt = 0;
for(int i = 0; i <= textAntic.length() - lng; i++)
{
string sub = textAntic.substr(i, lng);
if(M[sub] != 0)
{
cnt++;
M.erase(sub);
}
}
fout << cnt << "\n";
}
int main()
{
Citire();
return 0;
}
