Given a string, remove the punctuation from the string if the given character is a punctuation character as classified by the current C locale. The default C locale classifies these characters as punctuation:

!"#$%&'()*+,-./:;?@[\]^_`{|}~

#include <iostream>

using namespace std;

int main()
{
    // string with punctuations
    string str = "Welcome???@@@###S to hello world";

    // for loop to iterate the str string variable
    // len=str.size() storing the length of the str
    for(int i=0, len=str.size(); i<len; i++){
        if(ispunct(str[i])) // ispunct() // return's the boolean value of true or false on finding any punctuations marks
        {
            str.erase(i--, 1); //str.erease removes the found mark and shift the string to left
            len = str.size(); // update the new str length
        }
    }


    cout << str << endl;
    return 0;
}