Pagini recente » Cod sursa (job #1827002) | Cod sursa (job #2238025) | Cod sursa (job #778343) | Cod sursa (job #3002285) | Cod sursa (job #1814108)
#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' && a[j] != '\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;
}