+ 3

How to delete spacebars from string

input ('Hello world ') output ('Helloworld')

19th May 2020, 11:30 AM
Mushtuk Daniil
Mushtuk Daniil - avatar
4 Answers
+ 3
str = ''.join(input().split (' ')) https://code.sololearn.com/ckRVJ6B47m31/?ref=app
19th May 2020, 11:33 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 5
C/C++ version: void rm_space(char *s) { char *p; for (p = s; *s; s++) if (*s != ' ') *p++ = *s; *p = '\0'; }
19th May 2020, 1:39 PM
Gen2oo
Gen2oo - avatar
+ 3
in Python 3 input = 'Hello world ' output = input.replace(" ", "") print(output)
20th May 2020, 3:55 PM
B N Ajay Babu
B N Ajay Babu - avatar
+ 2
Gen2oo Such a beautiful code! Love it
19th May 2020, 1:51 PM
Abhishek Tandon
Abhishek Tandon - avatar