Remove last character from C++ string

Simple solution if you are using C++11. Probably O(1) time as well:

st.pop_back();

For a non-mutating version:

st = myString.substr(0, myString.size()-1);