import re
dates = '''06-18, 18:00:
06-18, 21:00:
06-19, 00:00:
06-19, 03:00:
06-19, 06:00:
06-19, 09:00:
06-19, 12:00:
06-19, 15:00:
06-19, 18:00:
06-19, 21:00:
06-20, 00:00:
06-20, 03:00:
06-20, 06:00:
06-20, 09:00:
06-20, 12:00:
06-20, 15:00:
06-20, 18:00:
06-20, 21:00:'''
result = ''
last_day = None
for date in dates.split('\n'):
day = re.search(r'\d+-(\d+)', date).group(1)
if day != last_day:
result += '\n{}\n'.format(date)
last_day = day
else:
result += '{}\n'.format(date)
print(result)