Im not sure if I used find\_first of and last\_of correctly, but what I want to do is that I need to print error when it finds \_ on the beginning or at the end of my code, plus when it finds two or more \_ next to each other, like this `lol___, lol__lol, _lol_, _lol, lol_,` and one more rule, \_ cannot be in front of capital letter, like this `lol_Lol`

here is my code

```
             std::string::size_type n;
             std::string::size_type n2;
             std::string::size_type n3;
             std::string const ss = slovo;

             n  = ss.find('_');
             n2 = ss.find_first_of('_');
             n3 = ss.find_last_of('_');

            if (n2 == std::string::npos && n3 == std::string::npos) {
            cout << "chyba" << endl;
            }else if(n == std::string::npos){

                  string s = transform(slovo);
                  cout << s << endl;

                  }else{
                  string s = untransform(slovo);
                  cout << s << endl;

                  }

```

EDIT>

```
if ( !ss.empty() && ss.front() == '_' && ss.back() == '_' )
               {
                cout << "Chyba" << endl;
               } else {

                if ( ss.length() > 3 && ss.find( '__', 1, ss.length() - 2 ) != std::string::npos )
                {

                 if (n == std::string::npos){

                      string s = transform(slovo);
                      cout << s << endl;

                      }else{
                      string s = untransform(slovo);
                      cout << s << endl;

                      }
                }else{
            cout << "chyba" << endl;

         } 
         }

```

EDIT2:

```
cin >> slovo;
             }      
             std::string::size_type n;
             std::string const ss = slovo;

             n  = ss.find('_');

             // kontrola podtrznika

           if ( ss.empty() && ss[0] == '_' && ss[ss.length() - 1] == '_' )
           {
            cout << "chyba" << endl;
            }

           if ( ss.length() > 3 && ss.find( "__", 1, ss.length() - 2 ) != std::string::npos )
           {
            cout << "chyba" << endl;
            }

             if (n == std::string::npos)
                 {
                  string s = transform(slovo);
                  cout << s << endl;

                  }else{
                  string s = untransform(slovo);
                  cout << s << endl;
                 }

```