Pagini recente » Cod sursa (job #1914827) | Cod sursa (job #1326432) | Cod sursa (job #284298) | Cod sursa (job #1826489) | Cod sursa (job #2935223)
#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;
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)
{
fout<<poz<<" ";
}
poz++;
}
return 0;
}