Cod sursa(job #1619680)
| Utilizator | Data | 28 februarie 2016 18:24:57 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <fstream>
#include <string>
using namespace std;
size_t x, oo=string::npos;
string A,B;
int ans[1002],i;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
fin>>A>>B;
x = -1;
while( 1 == 1 && 1 < 2 )
{
x = B.find( A , x + 1 );
if( x == oo )
break;
if( ans[ 0 ] <= 1000 )
ans[ ++ans[ 0 ] ] = x;
else
++ans[ 0 ];
}
fout<<ans[0]<<'\n';
for( i = 1 ; i <= min( ans[ 0 ] , 1000 ) ; i++ )
fout<<ans[ i ]<<' ';
return 0;
}
