Cod sursa(job #2281946)
Utilizator | Data | 12 noiembrie 2018 23:10:13 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 80 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
string a,b,z = "strmatch";
ifstream f(z+".in");
ofstream g(z+".out");
int Q,i=1,N,M;
vector<int> R;
int main()
{
f>>a>>b,N=M=-1;
for(;;){
N=b.find(a,N+1);
if(N==M) break;
Q++;
if(Q<=1000) R.push_back(N);
}
g<<Q<<"\n";
while(i<=min(Q,1000)){
g<<R[i++-1]<<" ";
}
}