Cod sursa(job #2386904)
| Utilizator | Data | 23 martie 2019 21:17:19 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
string a,b;
int poz,i,lg;
vector <int>pozi;
int main()
{
fin>>a>>b;
lg=b.size();
int found,k=0;
while (found!=std :: string ::npos)
{
found=b.find(a);
if(found!=std :: string ::npos) {
pozi.push_back(found);
b[found]='1';k++;}
}
fout<<k<<'\n';
for(int p=0;p<k;p++)
fout<<pozi[p]<<' ';
return 0;
}
