fork download
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main(){
  5. std::string line = "1 0 / 1 0 / 2 0 1 2 , P r o g r a m N a m e , V e n d o r N a m e , V 1 . 1 4 ";
  6.  
  7. int lsize = line.size(), at = 1;
  8. for(int i = 1; i < lsize; ++i)
  9. if(line[i-1] == ' ') line[at++] = line[i];
  10. // if there is no space behind it, skip it, it is a broken space itself!
  11. line.resize(at);
  12.  
  13. std::cout << line << std::endl;
  14. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
10/10/2012, Program Name, Vendor Name, V1.14