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

using namespace std;
 
int main() {
    
    SetConsoleCP(1251);
    SetConsoleOutputCP(1251);
    
    int firstvoskl;
    
	string s;
	cout << "Введите последовательность символов (первый символ отличен от воскл. знака):" << endl;
	cin >> s;
	
    firstvoskl= s.find_first_of('!'); // Поиск первого воскл. знака, если 0 - имеется, иначе - нет

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

 
	system("pause");
	return 0;
}
