def time_left(s):
    i = s.find('and')
    hcl, mcl, scl = extract_time(s[:i-1])
    hnow, mnow, snom = extract_time(s[i:-1])
    hdif, mdif, sdif = time_dif(hnow, mnow, snom, hcl, mcl, scl)
    if hdif == 0 and mdif < 10:
        text = 'Hurry up! The class starts in {} minutes and {} seconds.'.format(mdif, sdif)
    else:
        text = 'The class starts in {} hours, {} minutes and {} seconds.'.format(hdif, mdif, sdif)
    return text

def extract_time(s):
    i = s.find(':')
    ls = s[i-2:].split(':')
    return int(ls[0]), int(ls[1]), int(ls[2])

def time_dif(h1, m1, s1, h2, m2, s2):
    hdif = h2 - h1
    mdif = m2 - m1
    if mdif < 0:
        hdif -= 1
        mdif += 60
    sdif = s2 - s1
    if sdif < 0:
        mdif -= 1
        sdif += 60
    return hdif, mdif, sdif
