Main.cc: In function ‘int main()’: Main.cc:7:29: error: no matching function for call to ‘prev_permutation(std::__cxx11::basic_string::iterator)’ if(prev_permutation(n.end())&&n[0]!=0){ ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from Main.cc:1: /usr/include/c++/7/bits/stl_algo.h:3054:5: note: candidate: template bool std::prev_permutation(_BIter, _BIter) prev_permutation(_BidirectionalIterator __first, ^~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_algo.h:3054:5: note: template argument deduction/substitution failed: Main.cc:7:29: note: candidate expects 2 arguments, 1 provided if(prev_permutation(n.end())&&n[0]!=0){ ^ In file included from /usr/include/c++/7/algorithm:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65, from Main.cc:1: /usr/include/c++/7/bits/stl_algo.h:3086:5: note: candidate: template bool std::prev_permutation(_BIter, _BIter, _Compare) prev_permutation(_BidirectionalIterator __first, ^~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_algo.h:3086:5: note: template argument deduction/substitution failed: Main.cc:7:29: note: candidate expects 3 arguments, 1 provided if(prev_permutation(n.end())&&n[0]!=0){ ^