Remove spaces from a given string - GeekforGeeks
/*
http://ideone.com/fl1XGN
http://www.geeksforgeeks.org/remove-spaces-from-a-given-string/
http://www.practice.geeksforgeeks.org/problem-page.php?pid=454
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int t;
cin >> t;
cin.ignore();
while(t--){
string s, result="";
getline(cin, s);
int len = s.size();
for(int i=0; i<len; i++){
if(s[i] != ' ')
result += s[i];
}
cout << result << endl;
}
return 0;
}