Language: C++

#include <iostream>
using namespace std;
int main()
{
	string x;
	cin >> x;
	sort (x.begin() , x.end());
	if (x[0] == x[1] && x[0] != x[2] && x[2] == x[3])
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	string x;
	cin >> x;
	sort (x.begin() , x.end());
	if (x[0] == x[1] && x[0] != x[2] && x[2] == x[3])
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |         sort (x.begin() , x.end());
      |         ^~~~
      |         short
In file included from /usr/include/c++/14/bits/requires_hosted.h:31,
                 from /usr/include/c++/14/iostream:38,
                 from a.cc:1:
/usr/include/c++/14/bits/algorithmfwd.h:42:15: error: expected '=' before '__attribute__'
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/algorithmfwd.h:42:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/stl_algo.h:59,
                 from /usr/include/c++/14/algorithm:61,
                 from a.cc:17:
/usr/include/c++/14/bits/algorithmfwd.h:42:14: error: expected ';' before '__attribute__'
   42 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/algorithmfwd.h:43:1: error: expected primary-expression before '{' token
   43 | {
      | ^
/usr/include/c++/14/bits/stl_heap.h:63:15: error: expected '=' before '__attribute__'
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:63:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h:63:14: error: expected ';' before '__attribute__'
   63 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/stl_heap.h:64:1: error: expected primary-expression before '{' token
   64 | {
      | ^
/usr/include/c++/14/bits/uniform_int_dist.h:41:15: error: expected '=' before '__attribute__'
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/uniform_int_dist.h:41:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/stl_algo.h:65:
/usr/include/c++/14/bits/uniform_int_dist.h:41:14: error: expected ';' before '__attribute__'
   41 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/uniform_int_dist.h:42:1: error: expected primary-expression before '{' token
   42 | {
      | ^
/usr/include/c++/14/bits/stl_tempbuf.h:65:15: error: expected '=' before '__attribute__'
   65 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_tempbuf.h:65:15: error: expected identifier before '__attribute__'
In file included from /usr/include/c++/14/bits/stl_algo.h:69:
/usr/include/c++/14/bits/stl_tempbuf.h:65:14: error: expected ';' before '__attribute__'
   65 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/stl_tempbuf.h:66:1: error: expected primary-expression before '{' token
   66 | {
      | ^
/usr/include/c++/14/bits/stl_algo.h:77:15: error: expected '=' before '__attribute__'
   77 | namespace std _GLIBCXX_VISIBILITY(default)
      |               ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:77:15: error: expected identifier before '__attribute__'
/usr/include/c++/14/bits/stl_algo.h:77:14: error: expected ';' before '__attribute__'
   77 | namespace std _GLIBCXX_VISIBILITY(default)
      |              ^
      |              ;
/usr/include/c++/14/bits/stl_algo.h:78:1: error: expected primary-expression before '{' token
   78 | {
      | ^
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/execution_defs.h:15:1: error: 'namespace' definition is not allowed here
   15 | namespace __pstl
      | ^~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:17:1: error: 'namespace' definition is not allowed here
   17 | namespace std
      | ^~~~~~~~~
a.cc:19:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   19 | int main()
      |         ^~
a.cc:19:9: note: remove parentheses to default-initialize a variable
   19 | int main()
      |         ^~
      |         --
a.cc:19:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:20:1: error: a function-definition is not allowed here before '{' token
   20 | {
      | ^
a.cc:32:2: error: expected '}' at end of input
   32 | }
      |  ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^