def dateToMinute(date):
hour,minute=map(int,date.split(':'))
return hour*60+minute
def changed(song):
if 'A#' in song:
song=song.replace('A#','a')
if 'C#' in song:
song=song.replace('C#','c')
if 'D#' in song:
song=song.replace('D#','d')
if 'F#' in song:
song=song.replace('F#','f')
if 'G#' in song:
song=song.replace('G#','g')
return song
def solution(m, musicinfos):
answer = '(None)'
infos=[]
for music in musicinfos:
start,end,title,song =music.split(',')
start=dateToMinute(start)
end=dateToMinute(end)
song=changed(song)
m=changed(m)
infos.append((title,song*((end-start)//len(song))+song[:(end-start)%len(song)],end-start))
maxi=0
for info in infos:
if m in info[1]:
if info[2]>maxi:
maxi=info[2]
answer=info[0]
return answer