Simple, remove the spaces from the string, then return the resultant string.

~~~if:c
For C, you must return a new dynamically allocated string.
~~~

Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code:
def no_space(x):
	

Solutions:
def no_space(x):
	return x.replace(' ', '')


def no_space(s):
	return s.replace(' ', '')


def no_space(x):
	return ''.join(x.split())


def no_space(x):
	str_char = ''
	for i in range(len(x)):
		if x[i] == ' ':
			continue
		else:
			str_char = str_char + x[i]
	return str_char


def no_space(x):
	return ''.join((i for i in x if i != ' '))


def no_space(x):
	return ''.join([s for s in x if not s.isspace()])


no_space = lambda s: ''.join(filter(lambda ch: not ch == ' ', s))


def no_space(str):
	str = ''.join(str.split())
	return str


import re

def no_space(x):
	return re.sub('\\s+', '', x, 0)


def no_space(x):
	return x.replace(' ', '')
print(no_space('8asd sdhjk rr'))


def no_space(string):
	return string.replace(' ', '')


no_space = lambda x: ''.join(x.split())


def no_space(x):
	string = ''
	for i in x:
		if i.isspace() == False:
			string += i
	return string


def no_space(x):
	list = x.split()
	a = ''
	for i in range(len(list)):
		a = a + list[i]
	return a


import re

def no_space(x):
	res = re.sub(' ', '', x)
	return res
no_space('Hi How Are You')


def no_space(x):
	s = ''
	for letter in x:
		if letter != ' ':
			s += letter
	return s


no_space = lambda s: s.replace(' ', '')


def no_space(s):
	return ''.join([c for c in s if c != ' '])


def no_space(x):
	return ''.join([letter for letter in x if letter != ' '])


import re
no_space = lambda s: re.sub('\\s', '', s)


def no_space(x):
	S = ''
	for i in x:
		if i != ' ':
			S += i
	return S


def no_space(x):
	nx = ''
	for i in x:
		if i != ' ':
			nx += i
	return nx


def no_space(x):
	return ''.join((c for c in x if c != ' '))


def no_space(i):
	string = ''
	for x in i:
		if x != ' ':
			string += x
	return string


def no_space(x):
	ss = x.replace(' ', '')
	return ss


def no_space(x):
	res = ''
	for char in x:
		if char != ' ':
			res += char
	return res


def no_space(x):
	str = []
	for char in x:
		if char != ' ':
			str.append(char)
	return ''.join(str)


def no_space(x):
	char = ''
	for i in range(len(x)):
		if x[i] != ' ':
			char = char + x[i]
	return char


def no_space(x):
	x = list(x)
	y = ''
	for k in x:
		if k != ' ':
			y += k
	return y


def no_space(x):
	tmp = ''
	for char in x:
		if char is not ' ':
			tmp += char
	return tmp


def no_space(x):
	return x.replace(' ', '')
x = '8 j 8   mBliB8g  imjB8B8  jl  B'
print(no_space(x))


def no_space(x):
	output = ''
	split = x.split(' ')
	for i in split:
		output += i
	return output


def no_space(x):
	finalstring = ''
	for i in x:
		if i in ' ':
			pass
		else:
			finalstring += i
	return finalstring


def no_space(x):
	kk = ''
	for i in x:
		if i == ' ':
			continue
		else:
			kk = kk + i
	return kk


def no_space(x):
	a = x.split()
	s = ''.join(a)
	return s


def no_space(x):
	s = [i for i in x if i.isalnum()]
	n_s = ''.join(s)
	return n_s


def no_space(x):
	secondary = list()
	for i in x:
		if i != ' ':
			secondary.append(i)
	return ''.join(secondary)


def no_space(x):
	x_list = x.split()
	joinning = ''
	return joinning.join(x_list)


def no_space(x):
	return ''.join((y for y in x if y is not ' '))


def no_space(x):
	a = str()
	for i in x:
		if i != ' ':
			a = a + i
	return a


no_space = lambda p: p.replace(' ', '')


def no_space(x):
	new_string = ''
	for character in x:
		if character.isspace() == False:
			new_string += character
	return new_string


def no_space(x):
	return ''.join([word.strip() for word in x.split()])


def no_space(x):
	b = [a for a in x if a != ' ']
	return ''.join(b)


import regex as re

def no_space(x):
	return re.sub(' ', '', x)


def no_space(x):
	resultado = ''
	for i in range(len(x)):
		if x[i] != ' ':
			resultado += x[i]
	return resultado


def no_space(x):
	new_sen = ''
	character_num = 0
	for chars in x:
		if x[character_num] == ' ':
			character_num = character_num + 1
		else:
			new_sen = new_sen + x[character_num]
			character_num = character_num + 1
	return new_sen


def no_space(string):
	new_string = ''
	for i in string:
		if i != ' ':
			new_string += i
	return new_string


def no_space(x):
	a = ''
	for i in x:
		if i != ' ':
			a += i
	return a
print(no_space('8 j 8   mBliB8g  imjB8B8  jl  B'))


def no_space(x):
	x1 = ''
	for i in range(len(x)):
		if x[i].isspace() == True:
			pass
		else:
			x1 += x[i]
	return x1


def no_space(x):
	c = []
	for i in range(len(x)):
		c.append(x[i])
	while ' ' in c:
		c.remove(' ')
	return ''.join(c)


def no_space(x):
	no = x.replace(' ', '')
	return no


def no_space(x):
	string = ''
	for elem in x:
		if elem != ' ':
			string += elem
	return string


def no_space(x):
	return ''.join([chr for chr in x if chr != ' '])


def no_space(x):
	stri = ''
	for t in x:
		if t == ' ':
			pass
		else:
			stri += t
	return stri


def no_space(x):
	line = ''
	for i in x.split(' '):
		line = line + i.strip()
	return line


def no_space(x):
	z = ''
	for i in x:
		if not i == ' ':
			z = z + i
	return z


def no_space(x):
	lst = x.strip().split()
	strin = ''
	for el in lst:
		if el:
			strin += el
	return strin


def no_space(x):
	lists = x.split()
	str = ''
	for i in lists:
		str = str + i
	return str


def no_space(x='some text b '):
	return x.replace(' ', '')


def no_space(x):
	x = x.replace(' ', '')
	return x
print(no_space('8j aam'))


def no_space(x):
	bad = ' '
	for i in bad:
		str = x.replace(i, '')
		return str


def no_space(x):
	x = list(x)
	for i in range(len(x)):
		if x[i] == ' ':
			x.remove(x[i])
			x.append('')
	while x[-1] == '':
		x.pop()
	for i in range(len(x)):
		if x[i] == ' ':
			x.remove(x[i])
			x.append('')
	while x[-1] == '':
		x.pop()
	for i in range(len(x)):
		if x[i] == ' ':
			x.remove(x[i])
			x.append('')
	while x[-1] == '':
		x.pop()
	for i in range(len(x)):
		if x[i] == ' ':
			x.remove(x[i])
			x.append('')
	while x[-1] == '':
		x.pop()
	return ''.join(x)


def no_space(x):
	retStr = ''
	for i in range(0, len(x)):
		if x[i] != ' ':
			retStr += x[i]
	return retStr


def no_space(x):
	new_string = ''
	for letter in x:
		if letter == ' ':
			continue
		else:
			new_string += letter
	return new_string


def no_space(x):
	lista = []
	result = ''
	for n in x:
		if n != ' ':
			lista.append(n)
	for n in lista:
		result += n
	return result


def no_space(y):
	return y.replace(' ', '')


def no_space(x):
	x = list(x)
	l = ''
	for i in x:
		if i != ' ':
			l = l + i
	return l


def no_space(x):
	array = x.split(' ')
	for whitespace in array:
		if whitespace == '':
			array.remove(whitespace)
	a_string = ''.join(array)
	return a_string


def no_space(x):
	lis = [chr for chr in x if chr != ' ']
	s = ''
	return s.join(lis)


def no_space(word):
	new_word = ''
	for char in word:
		if char is not ' ':
			new_word = new_word + char
	return new_word


def no_space(x):
	string_no_space = x.replace(' ', '')
	return string_no_space


def no_space(x):
	z = ''
	for i in range(len(x)):
		if x[i] != ' ':
			z += x[i]
	return z


def no_space(x):
	result = ''
	for y in x:
		if y != ' ':
			result = result + y
	return result


def no_space(x):
	answer = ''
	for i in x:
		if i == ' ':
			continue
		else:
			answer += i
	return answer


def no_space(x):
	endstring = x.replace(' ', '')
	return endstring


def no_space(x):
	list = x.split()
	word = ''.join(list)
	return word


import re

def no_space2(x):
	x = re.sub('[\\s]', '', x)
	return x

def no_space(x):
	x = x.replace(' ', '')
	return x


def no_space(str):
	return ''.join((x for x in str if x != ' '))


def no_space(x):
	return x.replace(' ', '')
x = ' Hello '
print(no_space(x))


def no_space(x):
	new_string = ''
	for i in range(0, len(x)):
		if x[i] != ' ':
			new_string += x[i]
	return new_string


def no_space(x):
	string = x
	new = x.replace(' ', '')
	return new


def no_space(x):
	output = ''
	for w in x:
		if w != ' ':
			output += w
	return output


def no_space(x):
	z = ''
	for y in x:
		if y != ' ':
			z = z + y
		else:
			pass
	return z


def no_space(x):
	for i in range(5):
		spaces = i * ' '
		x = x.replace(spaces, '')
	return x