Cod sursa(job #2901393)

Utilizator stefanchpStefan Chiper stefanchp Data 13 mai 2022 17:38:42
Problema Abc2 Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <bits/stdc++.h>
#include <unordered_map>
#define N 100000
using namespace std;

ifstream fin("abc2.in");
ofstream fout("abc2.out");

unordered_map<string, int> M;
string text, aux;

int main()
{
    fin >> text;
    while (fin >> aux)
        M[aux] = 1;
    int lg = aux.size(), sol = 0;
    fin.close();
    for (int i = 0; i < text.size() - lg + 1; i++)
        if (M.find(text.substr(i, lg)) != M.end())
            sol++;
    fout << sol;
    fout.close();
    return 0;
}