#include <iostream>
#include <string.h>
#include <cstdlib>
using namespace std;
char* mas(char* input_s) {
char* mas_str = strtok(const_cast<char*>(input_s), " ");
return mas_str;
}
int* output_masstr(char* masstr) {
int count = 0, length = 0;
int* arr = new int[2];
printf("\nSlova ishodnoy stroki: \n");
while (masstr != '\0') {
int len = strlen(masstr);
printf("%s\n", masstr);
count++;
length += len;
masstr = strtok('\0', " ");
}
arr[0] = count;
arr[1] = length;
return arr;
}
void output_res(char* mas_str, int* arr, char character, int occurrences)
{
printf("\nСлова, содержащие не менее %d вхождений символа '%c':\n", occurrences, character);
int count_word = arr[0], length = arr[1];
while (mas_str != '\0')
{
int len = strlen(mas_str);
int count = 0;
for (int i = 0; i < len; i++)
{
if (mas_str[i] == character)
count++;
}
if (count >= occurrences)
{
printf("%s", mas_str);
}
mas_str = strtok('\0', " ");
}
}
int main() {
printf("Rabotu vipolnil: BBBO-08-23, Ishanov.D.A, Variant 7\n");
char input_s[256];
printf("\n Vvedite stroku: ");
fgets(input_s, 256, stdin);
char* masstr = mas(input_s);
output_res(masstr, output_masstr(masstr), 'a', 2);
return 0;
}
void output_res(char* mas_str, int* arr, char character, int occurrences)
void output_res(string mas_str, int* arr, char character, int occurrences)