Last active
March 30, 2020 17:18
-
-
Save andriiburka/11850fd5134a1a7b4e4bb9ed397f2632 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
/\\\\\\\\\ /\\\ | |
/\\////////\\\ \/\\\ | |
/\\\ \/\\\ \/\\\ /\\\ /\\\ | |
\/\\\ \/\\\ /\\/\\\\\\ \/\\\ /\\/\\\\\\\ \/// \/// | |
\/\\\\\\\\\\\\\\\ \/\\\////\\\ /\\\\\\\\\ \/\\\/////\\\ /\\\ /\\\ | |
\/\\\/////////\\\ \/\\\ \//\\\ /\\\////\\\ \/\\\ \/// \/\\\ \/\\\ | |
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\ | |
\/\\\ \/\\\ \/\\\ \/\\\ \//\\\\\\\/\\ \/\\\ \/\\\ \/\\\ | |
\/// \/// \/// \/// \///////\// \/// \/// \/// | |
/\\\\\\\\\\\\\ | |
\/\\\/////////\\\ /\\\ | |
\/\\\ \/\\\ \/\\\ | |
\/\\\\\\\\\\\\\\ /\\\ /\\\ /\\/\\\\\\\ \/\\\\\\\\ /\\\\\\\\\ | |
\/\\\/////////\\\ \/\\\ \/\\\ \/\\\/////\\\ \/\\\////\\\ \////////\\\ | |
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/// \/\\\\\\\\/ /\\\\\\\\\\ | |
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ \/\\\///\\\ /\\\/////\\\ | |
\/\\\\\\\\\\\\\/ \//\\\\\\\\\ \/\\\ \/\\\_\///\\\ \//\\\\\\\\/\\ | |
\///////////// \///////// \/// \/// \/// \////////\// ''' | |
import re | |
concert_dict = {} | |
bands_time = {} | |
popular_band_stars = '' | |
while True: | |
command = re.split("; ", input()) | |
if "start of concert" in command: | |
popular_band_stars = input() | |
break | |
elif "Add" in command: | |
cmd_add = command[0] | |
band_add = command[1] | |
stars_add = re.split(", ", command[2]) | |
if band_add not in concert_dict: | |
concert_dict[band_add] = stars_add | |
else: | |
for name in stars_add: | |
if name not in concert_dict[band_add] | |
concert_dict[band_add].append(name) | |
elif "Play" in command: | |
cmd_play = command[0] | |
band_play = command[1] | |
time_play = int(command[2]) | |
if band_play not in bands_time: | |
bands_time[band_play] = time_play | |
else: | |
bands_time[band_play] += time_play | |
for band, time in bands_time.items() | |
print(f"Total time: {sum()}") | |
for band, time in sorted(bands_time.items(), key=lambda item: -item[1]) | |
print(f"{band} -> {time}") | |
if popular_band_stars in concert_dict: | |
print(popular_band_stars) | |
for star in concert_dict[popular_band_stars] | |
print(f"=> {star}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment