Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char in[101];
char sub[31];
cout<<"Введи строку: ";
cin.getline(in, 101);
cout<<"Введи слово: ";
cin>> sub;
int count = 0;
int len = strlen(sub);
for(char *p = in; (p = strstr(p, sub)); p+=len){
++count;
}
cout << count << "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment