Language: C++

#include<iostream>
#include<bits/stdc++.h>

using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; //処理早くするためのおまじない
int main(){

string a,b,c;
cin>>a>>b>>c;

string next;
next.push_back(a[0]);

	while(true)
	{
		if(next=="a")
		{
			if(Sa.empty())
			{
				cout<<"A"<<endl;
				break;
			}
			next=*Sa.begin();
			Sa.erase(Sa.begin());
	 	}
	 	if(next=="b")
	 	{
			if(Sb.empty())
			{
				cout<<"B"<<endl;
				break;
			}
		next=*Sb.begin();
		Sb.erase(Sb.begin());
	 	}
	 	if(next=="c")
	 	{
			if(Sa.empty())
			{
				cout<<"C"<<endl;
				break;
			}
		next=*Sc.begin();
		Sc.erase(Sc.begin());
	 	}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    string A, B, C;
    cin >> A >> B >> C;
    
    string next;
    next.push_back( A[ 0 ] );
    
    int a{}, b{}, c{};
    while( true )
    {
        if( next == "a" )
        {
            if( A.empty() )
            {
                cout << "A" << endl;
                break;
            }
            next = *A.begin();
            A.erase( A.begin() );
            a++;
        }
        if( next == "b" )
        {
            if( B.empty() )
            {
                cout << "B" << endl;
                break;
            }
            next = *B.begin();
            B.erase( B.begin() );
            b++;
        }
        if( next == "c" )
        {
            if( C.empty() )
            {
                cout << "C" << endl;
                break;
            }
            next = *C.begin();
            C.erase( C.begin() );
            c++;
        }
    }
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:18:28: error: 'Sa' was not declared in this scope; did you mean 'a'?
   18 |                         if(Sa.empty())
      |                            ^~
      |                            a
a.cc:23:31: error: 'Sa' was not declared in this scope; did you mean 'a'?
   23 |                         next=*Sa.begin();
      |                               ^~
      |                               a
a.cc:28:28: error: 'Sb' was not declared in this scope; did you mean 'b'?
   28 |                         if(Sb.empty())
      |                            ^~
      |                            b
a.cc:33:23: error: 'Sb' was not declared in this scope; did you mean 'b'?
   33 |                 next=*Sb.begin();
      |                       ^~
      |                       b
a.cc:38:28: error: 'Sa' was not declared in this scope; did you mean 'a'?
   38 |                         if(Sa.empty())
      |                            ^~
      |                            a
a.cc:43:23: error: 'Sc' was not declared in this scope; did you mean 'c'?
   43 |                 next=*Sc.begin();
      |                       ^~
      |                       c
a.cc: At global scope:
a.cc:53:8: error: redefinition of 'struct cww'
   53 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
      |        ^~~
a.cc:5:8: note: previous definition of 'struct cww'
    5 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; //処理早くするためのおまじない
      |        ^~~
a.cc:53:59: error: conflicting declaration 'int star'
   53 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
      |                                                           ^~~~
a.cc:5:59: note: previous declaration as 'cww star'
    5 | struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; //処理早くするためのおまじない
      |                                                           ^~~~
a.cc:54:5: error: redefinition of 'int main()'
   54 | int main()
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main(){
      |     ^~~~