main.cpp: In function ‘int main(int, const char**)’:
main.cpp:80:11: error: no match for ‘operator>’ (operand types are ‘std::string {aka std::basic_string}’ and ‘int’)
if(state>stoi(argv[3]))
~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from main.cpp:9:
/usr/include/c++/6/bits/stl_pair.h:459:5: note: candidate: template constexpr bool std::operator>(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
^~~~~~~~
/usr/include/c++/6/bits/stl_pair.h:459:5: note: template argument deduction/substitution failed:
main.cpp:80:24: note: ‘std::string {aka std::basic_string}’ is not derived from ‘const std::pair<_T1, _T2>’
if(state>stoi(argv[3]))
^
In file included from /usr/include/c++/6/bits/stl_algobase.h:67:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/ios:40,
from /usr/include/c++/6/ostream:38,
from /usr/include/c++/6/iostream:39,
from main.cpp:9:
/usr/include/c++/6/bits/stl_iterator.h:313:5: note: candidate: template bool std::operator>(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
operator>(const reverse_iterator<_Iterator>& __x,
^~~~~~~~
/usr/include/c++/6/bits/stl_iterator.h:313:5: note: template argument deduction/substitution failed:
main.cpp:80:24: note: ‘std::string {aka std::basic_string}’ is not derived from ‘const std::reverse_iterator<_Iterator>’
if(state>stoi(argv[3]))
^
orL, _Container>’
The error message says you can't compare a string with an int. Which seems perfectly right and proper, don't you think? Not very clear what you intended to do here.
There's a few other problems (like not initialising length; inventing a variable "comma" that you then failed to use) but they are going to take a lot of sorting out unless you put your code in code tags.