Cod sursa(job #2055039)
| Utilizator | Data | 2 noiembrie 2017 19:19:03 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("strmatch.in");
ofstream fout ("strmatch.out");
int ans[1010],k,i,poz;
string a,b;
int main ()
{
size_t x = string::npos;
fin>>a>>b;
poz = -1;
do
{
poz = b.find( a , poz + 1 );
if( poz != x )
{
++k;
if( k <= 1000 )
ans[ k ] = poz;
}
}while( poz != x );
fout<<k<<'\n';
for( i = 1 ; i <= min( 1000 , k ) ; i++ )
fout<<ans[ i ]<<' ';
return 0;
}
