// Example YourStr.substr(YourStr.length() - 1) // Syntax std::string YourStr = "abcdef"; std::cout << YourStr.substr(YourStr.length() - 1) << " "; // OUTPUT: f