Pagini recente » Cod sursa (job #1057520) | Cod sursa (job #2416806) | Cod sursa (job #1787520) | Cod sursa (job #1577713) | Cod sursa (job #1814075)
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream f("strmatch.in");
ofstream g("strmatch.out");
int main(){
string a, b;
getline(f,a);
getline(f,b);
unsigned int i = 0, j = 0;
int count = 0;
while (b[i] != '\0') {
while (a[j] != '\0' && b[i] != '\0' && b[i] == a[j]) {
i++;
j++;
}
if (j == (a.length()))
count++;
i = i - j + 1;
j = 0;
}
g << count << "\n";
f.close();
g.close();
return 0;
}