D = "haha keke";
std::string::iterator it = std::remove(D.begin(), D.end(), ' ');
D.erase(it);
//you could compose them by
//D.erase(std::remove(D.begin(), D.end(), ' '));
cout<<D<<"\n";
hi friend, im beginer too , i see "single word" in your question and not "single char" i think word contain some char, notify me if im wrong about it , so this is what can i do for your problem