Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    char S;
    cin >> S;

    int a,b,;
    int ans = 0;
    int ans1  = 0;
    for (int i = 0; i < 3; i++) {
        for (int j = 1; j < 4; j++) {
            if (S[i] == S[j]) {
                a = i;
                b = j;
                ans = 1;
                break;
            }
        }
    }

    if ( a == 0 && b == 1 ) {
        if ( S[2] == S[3]) {
            ans1 = 1;
            break;
        }
    } else if ( a == 0 && b == 2 ) {
        if ( S[1] == S[3]) {
            ans1 = 1;
            break;
        }
    } else if ( a == 0 && b == 3 ) {
        if ( S[2] == S[3]) {
            ans1 = 1;
            break;
        }
    } else if ( a == 1 && b == 2 ) {
        if ( S[0] == S[3]) {
            ans1 = 1;
            break;
        }
    } else if ( a == 1 && b == 3 ) {
        if ( S[0] == S[2]) {
            ans1 = 1;
            break;
        }
    } else if ( a == 2 && b == 3 ) {
        if ( S[0] == S[1]) {
            ans1 = 1;
            break;
        }
    }
    if ( ans == 1 && ans1 == 1 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected unqualified-id before ';' token
    8 |     int a,b,;
      |             ^
a.cc:13:18: error: invalid types 'char[int]' for array subscript
   13 |             if (S[i] == S[j]) {
      |                  ^
a.cc:13:26: error: invalid types 'char[int]' for array subscript
   13 |             if (S[i] == S[j]) {
      |                          ^
a.cc:23:15: error: invalid types 'char[int]' for array subscript
   23 |         if ( S[2] == S[3]) {
      |               ^
a.cc:23:23: error: invalid types 'char[int]' for array subscript
   23 |         if ( S[2] == S[3]) {
      |                       ^
a.cc:25:13: error: break statement not within loop or switch
   25 |             break;
      |             ^~~~~
a.cc:28:15: error: invalid types 'char[int]' for array subscript
   28 |         if ( S[1] == S[3]) {
      |               ^
a.cc:28:23: error: invalid types 'char[int]' for array subscript
   28 |         if ( S[1] == S[3]) {
      |                       ^
a.cc:30:13: error: break statement not within loop or switch
   30 |             break;
      |             ^~~~~
a.cc:33:15: error: invalid types 'char[int]' for array subscript
   33 |         if ( S[2] == S[3]) {
      |               ^
a.cc:33:23: error: invalid types 'char[int]' for array subscript
   33 |         if ( S[2] == S[3]) {
      |                       ^
a.cc:35:13: error: break statement not within loop or switch
   35 |             break;
      |             ^~~~~
a.cc:38:15: error: invalid types 'char[int]' for array subscript
   38 |         if ( S[0] == S[3]) {
      |               ^
a.cc:38:23: error: invalid types 'char[int]' for array subscript
   38 |         if ( S[0] == S[3]) {
      |                       ^
a.cc:40:13: error: break statement not within loop or switch
   40 |             break;
      |             ^~~~~
a.cc:43:15: error: invalid types 'char[int]' for array subscript
   43 |         if ( S[0] == S[2]) {
      |               ^
a.cc:43:23: error: invalid types 'char[int]' for array subscript
   43 |         if ( S[0] == S[2]) {
      |                       ^
a.cc:45:13: error: break statement not within loop or switch
   45 |             break;
      |             ^~~~~
a.cc:48:15: error: invalid types 'char[int]' for array subscript
   48 |         if ( S[0] == S[1]) {
      |               ^
a.cc:48:23: error: invalid types 'char[int]' for array subscript
   48 |         if ( S[0] == S[1]) {
      |                       ^
a.cc:50:13: error: break statement not within loop or switch
   50 |             break;
      |             ^~~~~