Строка вводится с клавиатуры(максимум 99 символов). Первое слово должно быть с маленькой буквы или первая и последняя буквы этого слова не должны совпадать(иначе такое слово как Test не засчитается). Также будет засчитываться одна буква(abc d efg, буква d подходит, так как она и первая и последняя)
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cstring>
using std::strtok;
using std::strlen;
int main()
{
char a[100], *ptr;
cout << "Enter the string:" << endl;
cin.getline(a, 100);
cout << endl;
ptr = strtok(a, "., ");
while(ptr)
{
if(*ptr == *(ptr + strlen(ptr) - 1))
{
cout << ptr << ' ';
}
ptr = strtok(NULL, "., ");
}
cout << endl;
return 0;
}
int max(int temp1, int temp2);
int min(int temp1, int temp2);
int main(void){
int a, b, c, d, first_result, second_result;
printf("Введите первую пару чисел: ");
scanf("%d, %d", &a, &b);
a = min(a, b);
printf("Наименьшее число из первой пары = %d\n", a);
printf("Введите вторую пару чисел: ");
scanf("%d, %d", &c, &d);
c = min(c, d);
printf("Наименьшее число из второй пары чисел = %d\n", c);
a = max(a, c);
printf("Максимальное число из двух наименьших = %d\n", a);
return 0;
}
int max(int temp1, int temp2){
if (temp1 > temp2)
return temp1;
else
return temp2;
}
int min(int temp1, temp2){
if (temp1 < temp2)
return temp1;
else
return temp2;
}