Pagini recente » Cod sursa (job #66865) | Cod sursa (job #1067704) | Cod sursa (job #1958902) | Cod sursa (job #1841329) | Cod sursa (job #1135267)
#include<fstream>
#include<string>
using namespace std;
const int maxn = 2000000;
string s, t;
int a[maxn];
main(){
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
fin>>t>>s;
int k = 0;
for(int i=0;i<s.size();i++){
if(s[i]==t[0]){
bool ok = true;
for(int j=1;j<t.size();j++)
if(t[j]!=s[i+j]){
ok=false; break;
}
if(ok)a[k++]=i;
}
}
fout<<k<<"\n";
for(int j=0;j<k;j++)fout<<a[j]<<" ";
}