Cod sursa(job #2017267)
Utilizator | Data | 31 august 2017 18:01:56 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f ("strmatch.in");
ofstream g ("strmatch.out");
int sol,i=1,n,m;
string a,b;
vector <int> R;
int main()
{
f>>a>>b;
n=m=-1;
while(true)
{
n=b.find(a,n+1);
if(n==m) break;
++sol;
if(sol<=1000) R.push_back(n);
}
g<<sol<<'\n';
while(i<=min(sol,1000)) g<<R[i++-1]<<' ';
return 0;
}