Language: C++

#include<iostream>
using namespace std;
int main(){
    string str1,str2;
    int n,h,a;
    while(true){
        cin>>str1;
        str2="";
        a=str1.size();
        for(int i=0;i<a;i++){
            str2+=str1[i];
        }
        cin>>n;
        for(int i=0;i<n;i++){
            cin>>h;
            str1.insert(str2.substr(0,h-1));
            str1.erase(0,h-1)
        }
        cout<<str1<<endl;
        if(str1=="-") break;
        
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>)'
   16 |             str1.insert(str2.substr(0,h-1));
      |             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1876 |         insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
      |         ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1876:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 2069 |         insert(size_type __pos, const _Tp& __svt)
      |         ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:9: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 2086 |         insert(size_type __pos1, const _Tp& __svt,
      |         ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]'
 1831 |       insert(const_iterator __p, size_type __n, _CharT __c)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1831:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 1911 |       insert(const_iterator __p, initializer_list<_CharT> __l)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1911:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 1939 |       insert(size_type __pos1, const basic_string& __str)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1939:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 1963 |       insert(size_type __pos1, const basic_string& __str,
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note:   candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 1987 |       insert(size_type __pos, const _CharT* __s, size_type __n)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1987:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2007 |       insert(size_type __pos, const _CharT* __s)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2032 |       insert(size_type __pos, size_type __n, _CharT __c)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2032:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
 2051 |       insert(__const_iterator __p, _CharT __c)
      |       ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2051:7: note:   candidate expects 2 arguments, 1 provided
a.cc:17:30: error: expected ';' before '}' token
   17 |             str1.erase(0,h-1)
      |                              ^
      |                              ;
   18 |         }
      |         ~