Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string foo(string str)
- {
- char space = " ";
- string res;
- //str.replace_all(" ", " ");
- for(int i = 0; i < str.size(); i++)
- {
- if((str.at(i) == " ") && (i < str.size()-1)
- {
- try{
- if((str.at(i+1) == " "))
- {
- continue;
- }
- else{
- res += srt.at(i);
- }
- }
- catch(out_of_range)
- {
- }
- }
- else
- {
- //end;
- res += srt.at(i);
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement