Pagini recente » Cod sursa (job #1438459) | Cod sursa (job #1265016) | Cod sursa (job #798684) | Cod sursa (job #857120) | Cod sursa (job #2935255)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("strmatch.in");
ofstream fout ("strmatch.out");
int main()
{
string word;
string text;
fin>>word>>text;
int poz=0;
int cnt=0;
vector <int> v;
for (int i=0; i<text.size(); i++)
{
bool match=true;
for (int j=0; j<word.size(); j++)
{
if (text[poz+j]!=word[j])
{
match=false;
break;
}
}
if (match==true)
{
cnt++;
v.push_back(poz);
}
poz++;
}
fout<<v.size()<<'\n';
for (int i=0; i<v.size(); i++)
{
if (v.size()<1000)
{
fout<<v[i]<<" ";
}
}
return 0;
}