1#include <iostream>
2
3std::string IgnoreWhitespace(std::string str)
4{
5 for(int i = 0; i < str.length(); i++)
6 {
7 if(str[i] == ' ') str.erase(i, 1);
8 }
9
10 return str;
11}
12
13int main()
14{
15 std::string str = "W h i t e s p a c e";
16
17 std::cout << IgnoreWhitespace(str); // Output = Whitespace
18
19 return 0;
20}