Language: C++

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

int main(){
  string array[4],i=0,j,name[4];
  cin>>array[0]>>array[1]>>array[2];
  name[0]="A";
  name[1]="B";
  name[2]="C";
  for( ; ; ){
    if(array[i]=='a'){
      j=0;
    }else if(array[i]=='b'){
      j=1;
    }else if(array[i]=='c'){
      j=2;
    }
    if(array[i].size==0){
      cout<<name[i]<<endl;
      return 0;
    }
    array[i].erase(array[i].begin());
    i=j;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   11 |     if(array[i]=='a'){
      |             ^
a.cc:12:9: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   12 |       j=0;
      |         ^
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  817 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  828 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  840 |       operator=(_CharT __c)
      |       ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  858 |       operator=(basic_string&& __str)
      |       ^~~~~~~~
a.cc:13:19: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   13 |     }else if(array[i]=='b'){
      |                   ^
a.cc:15:19: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   15 |     }else if(array[i]=='c'){
      |                   ^
a.cc:18:13: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   18 |     if(array[i].size==0){
      |             ^
a.cc:19:17: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   19 |       cout<<name[i]<<endl;
      |                 ^
a.cc:22:10: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   22 |     array[i].erase(array[i].begin());
      |          ^
a.cc:22:25: error: no match for 'operator[]' (operand types are 'std::string [4]' {aka 'std::__cxx11::basic_string<char> [4]'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   22 |     array[i].erase(array[i].begin());
      |                         ^