# Arup Guha
# 12/3/2024
# Some code to verify result for COT 3100 Final Exam Question #6

# Builds a 2 digit string out of integer n. 0 <= n <= 99
def buildstr(n):

    # 2 digits.
    if n >= 10:
        return chr(n//10+ord('0')) + chr(n%10+ord('0'))

    # One digit so I pad with 0.
    else:
        return "0" + chr(n+ord('0'))

# Returns true iff the ascii values in s are in increasing order.
def isincreasing(s):
    for i in range(0, len(s)-1):
        if s[i] >= s[i+1]:
            return False
    return True

# My accumulator.
res = 0

# Loop through all possible times.
for h in range(1, 13):
    for m in range(0, 60):

        # Build my full string.
        left = buildstr(h)
        right = buildstr(m)
        tot = left+right

        # Check if it works, if so print and count it.
        if isincreasing(tot):
            print(left+":"+right)
            res += 1

# Ta da!
print(res)
