Pagini recente » Cod sursa (job #493576) | Cod sursa (job #1360177) | Cod sursa (job #673990) | Cod sursa (job #1969836) | Cod sursa (job #2935231)
#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;
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++;
if (cnt>1000)
{
return 0;
}
fout<<poz<<" ";
}
poz++;
}
return 0;
}