Pagini recente » Cod sursa (job #2045312) | Cod sursa (job #1495288) | Cod sursa (job #2402791) | Cod sursa (job #1376554) | Cod sursa (job #1135289)
#include<fstream>
#include<string>
using namespace std;
const int maxn = 2000005;
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";
if(k>1001)k=1001;
for(int j=0;j<k;j++)fout<<a[j]<<" ";
}