Cod sursa(job #3378739)
| Utilizator | Data | 27 noiembrie 2026 21:09:49 | |
|---|---|---|---|
| Problema | Abc2 | Scor | 0 |
| Compilator | cpp-64 | 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");
string s,x;
vector<string> v;
unordered_map<string, int> m;
int ans,l;
int main()
{
fin>>s;
while (fin>>x)
{
v.push_back(x);
l=x.length();
}
for (int i=0;i<=(int)s.length()-l;i++)
{
string window=s.substr(i, l);
m[window]++;
}
for (int i=0;i<(int)v.size();i++)
{
x=v[i];
if (m.count(x))
{
ans++;
m.erase(x);
}
}
fout<<ans;
return 0;
}
