Cod sursa(job #1618970)
Utilizator | Data | 28 februarie 2016 10:25:20 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 78 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <string>
using namespace std;
size_t x, oo=string::npos;
string A,B;
int ans[1001],i;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
fin>>A>>B;
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;
}