Cod sursa(job #2573664)
| Utilizator | Data | 5 martie 2020 18:34:46 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
#include <cstring>
# define pb push_back
#define nmax 50005
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a,b;
int ok,k,i;
vector <int>v;
int main()
{size_t found;
f>>a>>b;
found=-1;
ok=1;
while(ok)
{
found=b.find(a,found+1);
if(found!=string::npos)
{
k++;
v.pb(found);
}
else
ok=0;
}
g<<k<<"\n";
if(v.size()>1000)
k=999;
else
k=v.size();
for(i=0;i<k;i++)
g<<v[i]<<" ";
return 0;
}
