Language: C++

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

int main(){
	string A,B,C,D={};
  	cin >> A >> B >> C;	
  	D=A;
  	while(A[0]!={} && (B[0]!={} && C[0]!={})){
    	if(D==A){
          	if(A[0]==a){
            	A = A.substr(1,A.size()-1);
              	D = A;
            }
          	else if(A[0]==b){
            	A = A.substr(1,A.size()-1);
              	D = B;
            }
          	else if(A[0]==c){
            	A = A.substr(1,A.size()-1);
              	D = C;
            }
        	
          
        }
      	if(D==B){
          	if(B[0]==a){
            	B = B.substr(1,B.size()-1);
              	D = A;
            }
          	else if(B[0]==b){
            	B = B.substr(1,B.size()-1);
              	D = B;
            }
          	else if(B[0]==c){
            	B = B.substr(1,B.size()-1);
              	D = C;
            }
        	
          
        }
      	if(D==C){
          	if(C[0]==a){
            	C = C.substr(1,C.size()-1);
              	D = A;
            }
          	else if(C[0]==b){
            	C = C.substr(1,C.size()-1);
              	D = B;
            }
          	else if(C[0]==c){
            	C = C.substr(1,C.size()-1);
              	D = C;
            }
        	
          
        }
      	
    }
  	if(A=={}) cout << "A" << endl;
  	else if(B=={}) cout << "B" << endl;
  	else if(C=={}) cout << "C" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: expected primary-expression before '{' token
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |                     ^
a.cc:8:21: error: expected ')' before '{' token
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |              ~      ^
      |                     )
a.cc:8:27: error: expected identifier before '(' token
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |                           ^
a.cc:8:41: error: expected ';' before '[' token
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |                                         ^
      |                                         ;
a.cc:8:48: error: expected primary-expression before ')' token
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |                                                ^
a.cc:59:15: error: expected primary-expression before '{' token
   59 |         if(A=={}) cout << "A" << endl;
      |               ^
a.cc:59:15: error: expected ')' before '{' token
   59 |         if(A=={}) cout << "A" << endl;
      |           ~   ^
      |               )
a.cc:60:20: error: expected primary-expression before '{' token
   60 |         else if(B=={}) cout << "B" << endl;
      |                    ^
a.cc:60:20: error: expected ')' before '{' token
   60 |         else if(B=={}) cout << "B" << endl;
      |                ~   ^
      |                    )
a.cc:61:20: error: expected primary-expression before '{' token
   61 |         else if(C=={}) cout << "C" << endl;
      |                    ^
a.cc:61:20: error: expected ')' before '{' token
   61 |         else if(C=={}) cout << "C" << endl;
      |                ~   ^
      |                    )
a.cc:8:40: error: label 'C' used but not defined
    8 |         while(A[0]!={} && (B[0]!={} && C[0]!={})){
      |                                        ^