Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;

typedef long long ll;

int MOD=1000000007;


int main(){
    string S; cin >> S;
    ll Q; cin >> Q;
    vector<string> ans={};
    ans.push_back(S);
    for(ll i=0; i<Q; i++){
        ll Qa; cin >> Qa;
        if(Qa==1) reverse(ans.begin(),ans.end());
        else if(Qa==2){
            ll Qb; cin >> Qb;
            string Qc; cin >> Qc;
            if(Qb==1){
                ans=ans.insert(ans,Qc);
            }else if(Qb==2){
                ans.push_back(Qc);
            }
        }
    }
    for(ll i=0; i<ans.size(); i++){
        cout << ans[i];
    }
    cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:31: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::insert(std::vector<std::__cxx11::basic_string<char> >&, std::string&)'
   25 |                 ans=ans.insert(ans,Qc);
      |                     ~~~~~~~~~~^~~~~~~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
 1484 |         insert(const_iterator __position, _InputIterator __first,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; iterator = std::vector<std::__cxx11::basic_string<char> >::iterator; const_iterator = std::vector<std::__cxx11::basic_string<char> >::const_iterator; value_type = std::__cxx11::basic_string<char>]'
  133 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:135:27: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::vector<std::__cxx11::basic_string<char> >::const_iterator'
  135 |     insert(const_iterator __position, const value_type& __x)
      |            ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; iterator = std::vector<std::__cxx11::basic_string<char> >::iterator; const_iterator = std::vector<std::__cxx11::basic_string<char> >::const_iterator; value_type = std::__cxx11::basic_string<char>]'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:29: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::vector<std::__cxx11::basic_string<char> >::const_iterator'
 1395 |       insert(const_iterator __position, value_type&& __x)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; iterator = std::vector<std::__cxx11::basic_string<char> >::iterator; const_iterator = std::vector<std::__cxx11::basic_string<char> >::const_iterator]'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:29: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::vector<std::__cxx11::basic_string<char> >::const_iterator'
 1413 |       insert(const_iterator __position, initializer_list<value_type> __l)
      |              ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; iterator = std::vector<std::__cxx11::basic_string<char> >::iterator; const_iterator = std::vector<std::__cxx11::basic_string<char> >::const_iterator; size_type = long unsigned int; value_type = std::__cxx11::basic_string<char>]'
 1439 |       insert(const_iterator __position, size_type __n, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note:   candidate expects 3 arguments, 2 provided