Cod sursa(job #2855373)
| Utilizator | Data | 22 februarie 2022 13:15:45 | |
|---|---|---|---|
| Problema | Abc2 | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
ifstream f("abc2.in");
ofstream g("abc2.out");
char ant[10001], cuv[50001][21], nou[50001]={0};
int n=0,i=0;
int main()
{
f.getline(ant,10001);
while(f.getline(cuv[i],21))
i++;
for(int j=0; j<i; j++)
{
if(!strstr(nou,cuv[j]))
{
strcat(nou,cuv[j]);
strcat(nou," ");
}
}
char *p=strtok(nou," ");
while(p!=NULL)
{
if(strstr(ant,p))
n++;
p=strtok(NULL," ");
}
g<<n;
}
