Language: C++

using namespace std;
int main(void){
    string S;
    cin >> S;
    
    if( S.at(0) == S.at(1) && S.at(2) == S.at(3) )
    {std::cout << "Yes" << std::endl;}
    
    else if( S.at(0) == S.at(2) && S.at(1) == S.at(3) )
    {std::cout << "Yes" << std::endl;}
    
    else if( S.at(0) == S.at(3) && S.at(1) == S.at(2) )
    {std::cout << "Yes" << std::endl;}
    
    else {std::cout << "No" << std::endl;}
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
    3 |     string S;
      |     ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> S;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:4:12: error: 'S' was not declared in this scope
    4 |     cin >> S;
      |            ^
a.cc:7:11: error: 'cout' is not a member of 'std'
    7 |     {std::cout << "Yes" << std::endl;}
      |           ^~~~
a.cc:7:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:33: error: 'endl' is not a member of 'std'
    7 |     {std::cout << "Yes" << std::endl;}
      |                                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:10:11: error: 'cout' is not a member of 'std'
   10 |     {std::cout << "Yes" << std::endl;}
      |           ^~~~
a.cc:10:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:33: error: 'endl' is not a member of 'std'
   10 |     {std::cout << "Yes" << std::endl;}
      |                                 ^~~~
a.cc:10:33: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:13:11: error: 'cout' is not a member of 'std'
   13 |     {std::cout << "Yes" << std::endl;}
      |           ^~~~
a.cc:13:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:13:33: error: 'endl' is not a member of 'std'
   13 |     {std::cout << "Yes" << std::endl;}
      |                                 ^~~~
a.cc:13:33: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:15:16: error: 'cout' is not a member of 'std'
   15 |     else {std::cout << "No" << std::endl;}
      |                ^~~~
a.cc:15:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:37: error: 'endl' is not a member of 'std'
   15 |     else {std::cout << "No" << std::endl;}
      |                                     ^~~~
a.cc:15:37: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'