I know you're a beginner, but I would just like to show you all that code here:


for(int k = 0; k < str.length(); k++)
{
if (ispunct(str[k]))
{
str.erase(k, 1);
}
}