Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. /* Define your function here */
  5. string RemoveSpaces(string userString)
  6. {
  7. string final = "";
  8.  
  9.  
  10. int size = userString.size();
  11. for(int i = 0; i < size; i++)
  12. {
  13. char character = userString.at(i);
  14. if(userString.at(i) != ' ')
  15. {
  16. final = final + character;
  17. }
  18. }
  19. return final;
  20.  
  21. }
  22.  
  23. int main() {
  24. /* Type your code here. Your code must call the function. */
  25. string a;
  26. getline(cin, a);
  27. cout << RemoveSpaces(a) << endl;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement