#include <iostream>
#include <string>
#include <cstdlib>
#include <windows.h>
#include <algorithm>

using namespace std;

int main() {
    
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    
	string s;
	
	cout << "Введите последовательность символов (первый символ отличен от воскл. знака):" << endl;
	cin >> s;

    int i = s.find('!');

    s.erase (i);

    if (i == 0) {
                   cout << "Первый символ должен быть отличен от восклицательного знака!" << endl;
    } else if(s.find("он")!=-1||s.find("но")!=-1) {
                                                  cout << "Да, имеются." << endl;
           } else {     
                  cout << "Нет, отсутствуют." << endl;
      }

	system("pause");
	return 0;
}