This is an interview question Looking for best optimal solution to trim multiple spaces from a string. This operation should be in-place operation.
input =
This is a very simple implementation of removing extra whitespaces.
#include std::string trimExtraWhiteSpaces(std::string &str); int main(){ std::string str = " Apple is a fruit and I like it . "; str = trimExtraWhiteSpaces(str); std::cout<