Language: C++


#include<iostream>
#include<string>

int main(){

 string ani; cin>>ani;

  for(int i=0;i<ani.length();i++){

    if(ani[i] == 'A') cnt++;
    else if(ani[i] == 'B') cnt2++;
  }

  if(cnt > 0 && cnt2 >0)
  	cout<<"Yes"<<endl;
  else 
  	cout<<"No"<<endl;

return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:2: error: 'string' was not declared in this scope
    7 |  string ani; cin>>ani;
      |  ^~~~~~
a.cc:7:2: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:7:14: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |  string ani; cin>>ani;
      |              ^~~
      |              std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:19: error: 'ani' was not declared in this scope
    7 |  string ani; cin>>ani;
      |                   ^~~
a.cc:11:23: error: 'cnt' was not declared in this scope; did you mean 'int'?
   11 |     if(ani[i] == 'A') cnt++;
      |                       ^~~
      |                       int
a.cc:12:28: error: 'cnt2' was not declared in this scope
   12 |     else if(ani[i] == 'B') cnt2++;
      |                            ^~~~
a.cc:15:6: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |   if(cnt > 0 && cnt2 >0)
      |      ^~~
      |      int
a.cc:15:17: error: 'cnt2' was not declared in this scope
   15 |   if(cnt > 0 && cnt2 >0)
      |                 ^~~~
a.cc:16:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   16 |         cout<<"Yes"<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:16:22: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   16 |         cout<<"Yes"<<endl;
      |                      ^~~~
      |                      std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:18:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |         cout<<"No"<<endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:18:21: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |         cout<<"No"<<endl;
      |                     ^~~~
      |                     std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~