Pagini recente » Cod sursa (job #742680) | Cod sursa (job #554410) | Cod sursa (job #1336941) | Cod sursa (job #2215617) | Cod sursa (job #2588871)
#include <fstream>
#include <string>
#include <unordered_map>
using namespace std;
ifstream in("abc2.in");
ofstream out("abc2.out");
const int N = 10000001, M = 666019;
unordered_map <string, int> umap;
string text, str, str1;
int main()
{
int lmax;
getline(in, text);
while(getline(in, str))
{
lmax = str.length();
umap[str]++;
}
int c = 0, st = 0, dr = lmax - 1;
while(st + lmax - 1 < text.length())
{
str1 = text.substr(st, lmax);
if(umap[str1] != 0)
c++, umap[str1] = 0;
st++;
}
out << c;
return 0;
}