Language: C++

#include<iostream>
using namaspace std;

int main(){
    string S;
    cin >> S;
    if (S[0]==S[1] && S[1]!=S[2] && S[2]=S[3]) cout <<"Yes";
    else if(S[0]==S[2] && S[0]!=S[1] && S[1]==S[3]) cout <<"Yes";
    else if(S[0]==S[3] && S[0]!=S[1] && S[1]==S[2]) cout <<"Yes";
    else cout << "No";
    return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namaspace'
    2 | using namaspace std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:5: error: 'string' was not declared in this scope
    5 |     string S;
      |     ^~~~~~
a.cc:5:5: 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:1:
/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:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |     cin >> S;
      |     ^~~
      |     std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:6:12: error: 'S' was not declared in this scope
    6 |     cin >> S;
      |            ^
a.cc:7:48: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |     if (S[0]==S[1] && S[1]!=S[2] && S[2]=S[3]) cout <<"Yes";
      |                                                ^~~~
      |                                                std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:8:53: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |     else if(S[0]==S[2] && S[0]!=S[1] && S[1]==S[3]) cout <<"Yes";
      |                                                     ^~~~
      |                                                     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:9:53: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |     else if(S[0]==S[3] && S[0]!=S[1] && S[1]==S[2]) cout <<"Yes";
      |                                                     ^~~~
      |                                                     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:10: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |     else cout << "No";
      |          ^~~~
      |          std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~