Pagini recente » Cod sursa (job #1146521) | Cod sursa (job #2268340) | Cod sursa (job #2616737) | Cod sursa (job #1049833) | Cod sursa (job #2979118)
#include <fstream>
#include <string.h>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
char z[16];
int x,y;
char a[2000002];
char b[2000002];
int c[2000002];
int nr = 0;
int main()
{
fin >> a >> b;
x = strlen(a);
y = strlen(b);
for(int i = 0; i+x-1 <= y-1; i++){
bool ok = true;
for(int j = 0; j <= x-1; j++){
if(a[j] != b[i+j]){
ok = false;
break;
}
}
if(ok){
nr++;
c[nr] = i;
}
}
fout << nr << "\n";
for(int i = 1; i <= nr && i <= 1000; i++){
fout << c[i] << " ";
}
return 0;
}