Language: C++

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

int main(){
	string A,B,C,D={};
  	cin >> A >> B >> C;	
  	D=A;
  	while(A.empty!=1 && (B.empty!=1 && C.empty!=)){
    	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:17: error: invalid use of member function 'bool std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::empty() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (did you forget the '()' ?)
    8 |         while(A.empty!=1 && (B.empty!=1 && C.empty!=)){
      |               ~~^~~~~
      |                      ()
a.cc:8:32: error: invalid use of member function 'bool std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::empty() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (did you forget the '()' ?)
    8 |         while(A.empty!=1 && (B.empty!=1 && C.empty!=)){
      |                              ~~^~~~~
      |                                     ()
a.cc:8:53: error: expected primary-expression before ')' token
    8 |         while(A.empty!=1 && (B.empty!=1 && C.empty!=)){
      |                                                     ^
a.cc:10:26: error: 'a' was not declared in this scope
   10 |                 if(A[0]==a){
      |                          ^
a.cc:14:31: error: 'b' was not declared in this scope
   14 |                 else if(A[0]==b){
      |                               ^
a.cc:18:31: error: 'c' was not declared in this scope
   18 |                 else if(A[0]==c){
      |                               ^
a.cc:26:26: error: 'a' was not declared in this scope
   26 |                 if(B[0]==a){
      |                          ^
a.cc:30:31: error: 'b' was not declared in this scope
   30 |                 else if(B[0]==b){
      |                               ^
a.cc:34:31: error: 'c' was not declared in this scope
   34 |                 else if(B[0]==c){
      |                               ^
a.cc:42:26: error: 'a' was not declared in this scope
   42 |                 if(C[0]==a){
      |                          ^
a.cc:46:31: error: 'b' was not declared in this scope
   46 |                 else if(C[0]==b){
      |                               ^
a.cc:50:31: error: 'c' was not declared in this scope
   50 |                 else if(C[0]==c){
      |                               ^
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;
      |                ~   ^
      |                    )