
s=r"""New York City; Iron Man; no superpowers
Metropolis; Superman; superpowers;
New York City;
Spider-Man;
superpowers;
Gotham; Batman; no superpowers;
New York City; Doctor Strange; superpowers;"""
tmp = ''
for line in s.splitlines():
	if len(line.rstrip(';').split(';')) < 3:
		tmp += line
	else:
		if tmp: # write fixed line to fixed file
			print(tmp)
			tmp = ''
		else: # write existing line to fixed file
			print(line)