Cod sursa(job #1970965)
Utilizator | Data | 19 aprilie 2017 18:55:44 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 14 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.66 kb |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ifstream f("strmatch.in");
ofstream g("strmatch.out");
string a;
string b;
f>>a>>b;
long long rep=0, gasit;
for(int i=0; i<b.size(); ++i)
{
if(b[i]==a[0])
{
gasit=1;
for(int j=1; j<a.size(); ++j)
{
if(b[i+j]!=a[j])
{
gasit=0;
break;
}
}
if(gasit==1)
rep++;
}
}
g<<rep;
return 0;
}