Language: C++

#include <iostream>
#include <string>
#include <algorithm>

int main(){
    int m,n;
    std::string str,tes;
    while(true){
    std::cin >> str >> m;
    for(int a=0;a<m;a++){
        std::cin >> n;
        if(n==-")break;
        tes=str.substr(0,n);
        str.erase(str.begin(), str.begin()+n);
        str += tes;
        std::cout << str << std::endl;
    }
    std::cout << tes << std::endl;
    }
    return 0;
}

Compiler output:
a.cc:12:16: warning: missing terminating " character
   12 |         if(n==-")break;
      |                ^
a.cc:12:16: error: missing terminating " character
   12 |         if(n==-")break;
      |                ^~~~~~~~
a.cc: In function 'int main()':
a.cc:12:15: error: no match for 'operator-' (operand type is 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   12 |         if(n==-")break;
      |               ^~~~~~~~~
   13 |         tes=str.substr(0,n);
      |         ~~~    
In file included from /usr/include/c++/14/string:48,
                 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/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   candidate expects 2 arguments, 1 provided
a.cc:14:46: error: expected ')' before ';' token
   14 |         str.erase(str.begin(), str.begin()+n);
      |                                              ^
      |                                              )
a.cc:12:11: note: to match this '('
   12 |         if(n==-")break;
      |           ^
a.cc:14:18: error: could not convert 'str.std::__cxx11::basic_string<char>::erase(__gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >(str.std::__cxx11::basic_string<char>::begin()), __gnu_cxx::__normal_iterator<const char*, std::__cxx11::basic_string<char> >(str.std::__cxx11::basic_string<char>::begin().__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::operator+(((__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >::difference_type)n))))' from 'std::__cxx11::basic_string<char>::iterator' to 'bool'
   14 |         str.erase(str.begin(), str.begin()+n);
      |         ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                  |
      |                  std::__cxx11::basic_string<char>::iterator