I want to write a program in c++ that get a sentence and insert a space between each word and punctuation in it! in sed script this is done with this expression:
sed -e "s/,([^0-9])/ , 1/g" -e "s/.([^0-9])/ . 1/g" -e s/.[ ]*$/ ./g -e "s/ / /g" -e s/?/ ?/g -e s/``/ `` /g -e "s/ / /g" -e s/(/ ( /g -e s/)/ ) /g -e s/ . ([^$])/. 1/g -e "s/ s/ s/g" -e "s/"([^"]*)"/" 1 "/g" $1 | sed -e "s/"([^"]*)"/``1 /g"
But I don t khow how i should do this in c++ in windows! for example: should convert a "The question now: Can he act more like hard-charging Teddy Roosevelt." must be converted to "The question now : Can he act more like hard-charging Teddy Roosevelt ." So a punctuation such as - or for example a . in "No." should not spacing in a sentence, but other punctuation that don t rely on a word or a phrase should be spaced.