Cod sursa(job #2675093)
Utilizator | Data | 21 noiembrie 2020 10:00:33 | |
---|---|---|---|
Problema | Invers modular | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.48 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f ("strmatch.in");
ofstream g ("strmatch.out");
char A[2000001],B[2000001];
int poz[2000001];
int main()
{
f.getline(A,2000001);
f.getline(B,2000001);
int cnt = 1;
char *p = strstr(B,A);
while(p && cnt<1001)
{
poz[cnt++] = p-B;
p = strstr(p+1,A);
}
g << cnt-1<< '\n';
for(int i = 1;i<min(cnt,1001);i++)
g << poz[i]<< " ";
}