
d = ['this', 'is', 'page', 'hello', 'guys']
m = ["H e l l o g u y s", "T h i s i s P a g e 1", "H e l l o   g u y s", "H e l l o  g u y s"]
j = ''.join(m[0].split()).lower()

temp = []
fix = []


for i in j:
	temp.append(i)
	s = ''.join(temp) 

	if s in d:
		fix.append(s)		
		del temp[:]
	
	if i.isdigit():
		fix.append(i)
	
print(' '.join(fix))


