Pagini recente » Cod sursa (job #2855483) | Rating Test P (round2) | Cod sursa (job #854156) | Cod sursa (job #1759123) | Cod sursa (job #2855356)
#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;
}