Language: C++

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

int main() {
  string a,b,c;
  char t = 'a';
  cin >> a >> b >> c;
  reverse(a.begin,a.end);
  reverse(b.begin,b.end);
  reverse(c.begin,c.end);
  while(true){
    if(t == 'a'){
      if(a.size() == 0){
        break;
      }
      t = a.at(a.size() - 1);
      a.pop_back;
    }
    if(t == 'b'){
      if(b.size() == 0){
        break;
      }
      t = b.at(b.size() - 1);
      b.pop_back;
    }
    if(t == 'c'){
      if(c.size() == 0){
        break;
      }
      t = c.at(c.size() - 1);
      c.pop_back;
    }
  }
  cout << t << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
    8 |   reverse(a.begin,a.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   template argument deduction/substitution failed:
a.cc:8:10: note:   couldn't deduce template parameter '_BIter'
    8 |   reverse(a.begin,a.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
a.cc:9:10: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
    9 |   reverse(b.begin,b.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   template argument deduction/substitution failed:
a.cc:9:10: note:   couldn't deduce template parameter '_BIter'
    9 |   reverse(b.begin,b.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
a.cc:10:10: error: no matching function for call to 'reverse(<unresolved overloaded function type>, <unresolved overloaded function type>)'
   10 |   reverse(c.begin,c.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
 1083 |     reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
      |     ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note:   template argument deduction/substitution failed:
a.cc:10:10: note:   couldn't deduce template parameter '_BIter'
   10 |   reverse(c.begin,c.end);
      |   ~~~~~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
  249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
      | ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note:   candidate expects 3 arguments, 2 provided
a.cc:17:9: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   17 |       a.pop_back;
      |       ~~^~~~~~~~
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:
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~
a.cc:24:9: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   24 |       b.pop_back;
      |       ~~^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~
a.cc:31:9: error: invalid use of non-static member function 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::pop_back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   31 |       c.pop_back;
      |       ~~^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2174:7: note: declared here
 2174 |       pop_back() noexcept
      |       ^~~~~~~~