Language: C++

#include <iostream>
#include <set>
#include <vector>
#include <iomanip>
#include <deque>


#include <algorithm>

#include <cfenv>
#include <cmath>
typedef long long int ll;

using namespace std;
#include <string>

int main()
{


     deque<char> S;

     string s;
     ll Q;

     bool riv_flag =0;


     

     cin >> s;
     for(char c: s){

         S.push_back(c);


         
     }

     cin >>Q;







     for(ll i=0;i<Q;i++){


         ll T;


         cin >> T;

         if(T ==1 ){


             if(riv_flag ==0){

                 riv_flag =1;
             }
             else{

                 riv_flag =0;
             }
         }
         else{


             ll F;
             char C;

             cin >> F >> C;

             if(!riv_flag){


                 if(F ==1){

                     S.push_front(C);
                 }
                 else{

                     S = S.push_back(C);
                 }


             }
             else{


                 if(F ==1){

                     S = S.push_back(C);
                 }
                 else{

                     S.push_front(C);
                 }


                 
             }
         }


         
     }


     if(!riv_flag ){


         cout << S << endl;
     }
     else{


         reverse(S.begin(),S.end());

         cout << S << endl;
     }

    


    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:39: error: no match for 'operator=' (operand types are 'std::deque<char>' and 'void')
   85 |                      S = S.push_back(C);
      |                                       ^
In file included from /usr/include/c++/14/deque:69,
                 from a.cc:5:
/usr/include/c++/14/bits/deque.tcc:95:5: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(const std::deque<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]'
   95 |     deque<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/deque.tcc:96:28: note:   no known conversion for argument 1 from 'void' to 'const std::deque<char>&'
   96 |     operator=(const deque& __x)
      |               ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/deque:66:
/usr/include/c++/14/bits/stl_deque.h:1052:7: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(std::deque<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]'
 1052 |       operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1052:25: note:   no known conversion for argument 1 from 'void' to 'std::deque<char>&&'
 1052 |       operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal())
      |                 ~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1071:7: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = char; _Alloc = std::allocator<char>]'
 1071 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1071:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<char>'
 1071 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:95:39: error: no match for 'operator=' (operand types are 'std::deque<char>' and 'void')
   95 |                      S = S.push_back(C);
      |                                       ^
/usr/include/c++/14/bits/deque.tcc:95:5: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(const std::deque<_Tp, _Alloc>&) [with _Tp = char; _Alloc = std::allocator<char>]'
   95 |     deque<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/deque.tcc:96:28: note:   no known conversion for argument 1 from 'void' to 'const std::deque<char>&'
   96 |     operator=(const deque& __x)
      |               ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1052:7: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(std::deque<_Tp, _Alloc>&&) [with _Tp = char; _Alloc = std::allocator<char>]'
 1052 |       operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1052:25: note:   no known conversion for argument 1 from 'void' to 'std::deque<char>&&'
 1052 |       operator=(deque&& __x) noexcept(_Alloc_traits::_S_always_equal())
      |                 ~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1071:7: note: candidate: 'std::deque<_Tp, _Alloc>& std::deque<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = char; _Alloc = std::allocator<char>]'
 1071 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1071:46: note:   no known conversion for argument 1 from 'void' to 'std::initializer_list<char>'
 1071 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:115:15: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::deque<char>')
  115 |          cout << S << endl;
      |          ~~~~ ^~ ~
      |          |       |
      |          |       std::deque<char>
      |          std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  116 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note:   no known conversion for argument 1 from 'std::deque<char>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
  116 |       operator<<(__ostream_type& (*__pf)(__ostream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
  125 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |       ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note:   no known conversion for argument 1 from 'std::deque<char>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
  125 |       operator<<(__ios_type& (*__pf)(__ios_type&))
      |                  ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  135 |       operator<<(ios_base& (*__pf) (ios_base&))
      |       ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note:   no known conversion for argument 1 from 'std::deque<char>' to 'std::ios_base& (*)(std::ios_base&)'
  135 |       operator<<(ios_base& (*__pf) (ios_base&))
      |                  ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  174 |       operator<<(long __n)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note:   no known conversion for argument 1 from 'std::deque<char>' to 'long int'
  174 |       operator<<(long __n)
      |                  ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  178 |       operator<<(unsigned long __n)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note:   no known conversion for argument 1 from 'std::deque<char>' to 'long unsigned int'
  178 |       operator<<(unsigned long __n)
      |                  ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  182 |       operator<<(bool __n)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note:   no known conversion for argument 1 from 'std::deque<char>' to 'bool'
  182 |       operator<<(bool __n)
      |                  ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
   96 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note:   no known conversion for argument 1 from 'std::deque<char>' to 'short int'
   97 |     operator<<(short __n)
      |                ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  189 |       operator<<(unsigned short __n)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note:   no known conversion for argument 1 from 'std::deque<char>' to 'short unsigned int'
  189 |       operator<<(unsigned short __n)
      |                  ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
  110 |     basic_ostream<_CharT, _Traits>::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note:   no known conversion for argument 1 from 'std::deque<char>' to 'int'
  111 |     operator<<(int __n)
      |                ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  200 |       operator<<(unsigned int __n)
      |       ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note:   no known conversion for argument 1 from 'std::deque<char>' to 'unsigned int'
  200 |       operator<<(unsigned int __n)
      |                  ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
  211 |       operator<<(long long __n)
      |       ^~~~~~~~
/usr/include