function solution(m, musicinfos) {
var answer = []
var obj = {}
for (var i = 0; i < musicinfos.length; i++) {
var arr = musicinfos[i].split(',')
var a = arr[0].split(':')
var b = arr[1].split(':')
var length = (b[0] - a[0]) * 60 + (b[1] - a[1])
var str = ''
arr[3] = arr[3]
.replace(/(C#)/g, 'c')
.replace(/(D#)/g, 'd')
.replace(/(F#)/g, 'f')
.replace(/(G#)/g, 'g')
.replace(/(A#)/g, 'a')
m = m
.replace(/(C#)/g, 'c')
.replace(/(D#)/g, 'd')
.replace(/(F#)/g, 'f')
.replace(/(G#)/g, 'g')
.replace(/(A#)/g, 'a')
for (var j = 0; j < length; j++) {
str += arr[3][j % arr[3].length]
}
obj[arr[2]] = str
}
for (var key in obj) {
if (obj[key].indexOf(m) >= 0) {
if (answer.length === 0) {
answer = [key, obj[key].length]
}
if (obj[key].length > answer[1]) {
answer = [key, obj[key].length]
}
}
}
if (answer.length > 0) {
return answer[0]
}
return '(None)'
}