Cod sursa(job #2855349)

Utilizator CrisanelCrisan Alexandru Crisanel Data 22 februarie 2022 12:56:08
Problema Abc2 Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <iostream>
#include <fstream>
#include <cstring>

using namespace std;

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

char dex[2000];

char cuv[200];

int cnd = 0;

void t (char dex2[], char cuv[]) {
    if (strstr(dex2, cuv)) {
        //cout << dex2 << " " << cuv << "\n";
        cnd ++;
        t(strstr(dex2, cuv) + 1, cuv);
    }
}

int main()
{
    char dex2[2000];

    in.getline(dex, 1999);

    while(in >> cuv) {
        strcpy(dex2, dex);
        t(dex2, cuv);
    }

    char c1[200] = "balexb";
    char c2[200] = "xe";
    //cout << strstr(c1,c2);
    out << cnd-1;

    return 0;
}