Cod sursa(job #2935223)
| Utilizator | Data | 6 noiembrie 2022 13:17:56 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#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;
}
