Language: C++

#include<iostream>
using namespace std;
int main() {
	int S;
	cin >> S;
	if (S[0] == S[1]) {
		if (S[2] == S[3] && S[0] != S[2]) cout << "Yes";
		else cout << "No";
	} else if (S[0] == S[2]) {
		if (S[3] == S[1] && S[0] != S[3]) cout << "Yes";
		else cout << "No";
	} else if (S[0] == S[3]) {
		if (S[1] == S[2] && S[0] != S[1]) cout << "Yes";
		else cout << "No";
	} else cout << "No";
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: invalid types 'int[int]' for array subscript
    6 |         if (S[0] == S[1]) {
      |              ^
a.cc:6:22: error: invalid types 'int[int]' for array subscript
    6 |         if (S[0] == S[1]) {
      |                      ^
a.cc:7:22: error: invalid types 'int[int]' for array subscript
    7 |                 if (S[2] == S[3] && S[0] != S[2]) cout << "Yes";
      |                      ^
a.cc:7:30: error: invalid types 'int[int]' for array subscript
    7 |                 if (S[2] == S[3] && S[0] != S[2]) cout << "Yes";
      |                              ^
a.cc:7:38: error: invalid types 'int[int]' for array subscript
    7 |                 if (S[2] == S[3] && S[0] != S[2]) cout << "Yes";
      |                                      ^
a.cc:7:46: error: invalid types 'int[int]' for array subscript
    7 |                 if (S[2] == S[3] && S[0] != S[2]) cout << "Yes";
      |                                              ^
a.cc:9:21: error: invalid types 'int[int]' for array subscript
    9 |         } else if (S[0] == S[2]) {
      |                     ^
a.cc:9:29: error: invalid types 'int[int]' for array subscript
    9 |         } else if (S[0] == S[2]) {
      |                             ^
a.cc:10:22: error: invalid types 'int[int]' for array subscript
   10 |                 if (S[3] == S[1] && S[0] != S[3]) cout << "Yes";
      |                      ^
a.cc:10:30: error: invalid types 'int[int]' for array subscript
   10 |                 if (S[3] == S[1] && S[0] != S[3]) cout << "Yes";
      |                              ^
a.cc:10:38: error: invalid types 'int[int]' for array subscript
   10 |                 if (S[3] == S[1] && S[0] != S[3]) cout << "Yes";
      |                                      ^
a.cc:10:46: error: invalid types 'int[int]' for array subscript
   10 |                 if (S[3] == S[1] && S[0] != S[3]) cout << "Yes";
      |                                              ^
a.cc:12:21: error: invalid types 'int[int]' for array subscript
   12 |         } else if (S[0] == S[3]) {
      |                     ^
a.cc:12:29: error: invalid types 'int[int]' for array subscript
   12 |         } else if (S[0] == S[3]) {
      |                             ^
a.cc:13:22: error: invalid types 'int[int]' for array subscript
   13 |                 if (S[1] == S[2] && S[0] != S[1]) cout << "Yes";
      |                      ^
a.cc:13:30: error: invalid types 'int[int]' for array subscript
   13 |                 if (S[1] == S[2] && S[0] != S[1]) cout << "Yes";
      |                              ^
a.cc:13:38: error: invalid types 'int[int]' for array subscript
   13 |                 if (S[1] == S[2] && S[0] != S[1]) cout << "Yes";
      |                                      ^
a.cc:13:46: error: invalid types 'int[int]' for array subscript
   13 |                 if (S[1] == S[2] && S[0] != S[1]) cout << "Yes";
      |                                              ^