Pagini recente » Cod sursa (job #1109921) | Cod sursa (job #2092886) | Cod sursa (job #99859) | Cod sursa (job #1062739) | Cod sursa (job #1412484)
#include<fstream>
#include<iostream>
#include<cstring>
using namespace std;
char a[2000010],b[2000010];
int v[1010],k;
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
int main()
{
int e=0;
int nr,x=0,x1,nr1;
fin.get(a,2000010);
nr=strlen(a);
while(fin)
{
fin>>b[x];
if(x>=nr-1)
{
e=1;
x1=x;
nr1=nr-1;
while(e and nr1>=0)
{
if(a[nr1]==b[x1])
{
nr1--;
x1--;
}
else e=0;
}
if(e==1)
{
k++;
if(k<=1000)
{
v[k]=x1+1;
}
}
}
x++;
}
fout<<k<<'\n';
for(int a1=1;a1<=k;a1++)
{
fout<<v[a1]<<" ";
}
}