str.pop_back(); // removes last /back character from str
str.erase(str.begin()); // removes first/front character from str
string name = "My String";
// To remove First character
name.erase(name.begin());
// To remove Last character
name.pop_back();
std::cout << name << std::endl;
// Output : y Strin