I want to erase from a string all puctuation characters. This is my code so far:
PHP Code:
string input;
string bad "!@#$%^&*()~`[]{}-=_+|\"\'\\<>,.?/ ";

cout << "Enter a string: ";
getline(cininput'\n');

for (
int i 0<= input.length(); i++)
    for (
int j 0<= bad.length() - 1j++)
        if (
input[i] == bad[j])
        {
            
cout << "Bad character found: \"" << bad[j] << "\"" << endl;
            
input.erase(i1);
        }

cout << input << endl
The problem is this: if I enter "he&&&llo" for example, it only erases two ampersands, and the result is "he&llo". How can I fix this?