"""
Created on: Tue Oct  8 21:43:13 2024
Author: vila@cs.upc.edu
"""
def age_comp(s):
    i = s.find('.')
    d1, m1, y1 = extract_date(s[:i])
    d2, m2, y2 = extract_date(s[i+1:-1])
    age = y1 - y2
    if d1 == d2 and m1 == m2:
        text = 'Happy ' + str(age) + 'th birthday !' 
    else:
        if m1 < m2 or (m1 == m2 and d1 < d2):
            age -= 1
        text = 'You are {} years old.'.format(age)
    return text

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