Mai intai trebuie sa te autentifici.
Cod sursa(job #2855356)
Utilizator | Data | 22 februarie 2022 13:01:54 | |
---|---|---|---|
Problema | Abc2 | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.97 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) + strlen(cuv), cuv);
}
}
char dix[2000][100];
bool unic (char cc[]) {
for(int i = 0; i < 1999; i ++) {
if (!strcmp(dix[i], cc))
return false;
if (dix[i] == " ")
return true;
}
}
int main()
{
char dex2[2000];
in.getline(dex, 1999);
int i = 0;
while(in >> cuv) {
if (unic(cuv)) {
strcpy(dix[i],cuv);
i++;
strcpy(dex2, dex);
t(dex2, cuv);
}
}
char c1[200] = "balexb";
char c2[200] = "xe";
//cout << strstr(c1,c2);
out << cnd;
return 0;
}