Pagini recente » Cod sursa (job #3323790) | Cod sursa (job #1902413) | Cod sursa (job #2010683) | Cod sursa (job #1461526) | Cod sursa (job #1461523)
#include <fstream>
using namespace std;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main(){
int i, m, n, x, q = 0, v[200000];
char a[2000001],b[2000001];
for(m = 0;fin.get(a[m]) && a[m] != '\n'; m++);a[m] = '\0';
for(n = 0;fin.get(b[n]) && b[n] != '\n'; n++);b[n] = '\0';
fin.close();
for(i = 0; i < n; i++){
x = 0;
while(a[x] && a[x] == b[i + x])x++;
if(x == m){
v[q] = i;
q++;
}
}
fout << q << endl;
for(i = 0; i < q; i++)
fout << v[q] << " ";
fout.close();
return 0;
}