Under construction

Still being built. Things may change

Word Clock

Interview

Time limit0.5sMemory limit512 MB

Summary
Convert an hour and minute into the words a word clock shows, using past or to and special phrases for 0, 15, 30, and 45 minutes.
Level

Easy3 of 10

Topics
Implementation, String, Math, Simulation
Solved
No attempts yet

Problem

A word clock tells the time using words. Here are some examples.

  • 5:00 → five o' clock
  • 5:01 → one minute past five
  • 5:10 → ten minutes past five
  • 5:15 → quarter past five
  • 5:28 → twenty eight minutes past five
  • 5:30 → half past five
  • 5:40 → twenty minutes to six
  • 5:45 → quarter to six
  • 5:47 → thirteen minutes to six

When the minutes are 0, use "o' clock". When 1 ≤ minutes ≤ 30, use "past". When minutes > 30, use "to".

Given a time, print it in the phrasing a word clock uses.

Input

The first line gives the hour h (1 ≤ h ≤ 12), and the second line gives the minute m (0 ≤ m < 60).

Output

On the first line, print the given time in the phrasing a word clock uses.

Examples4

  1. Example 1

    Input
    5
    47
    
    Expected output
    thirteen minutes to six
    
  2. Example 2

    Input
    3
    0
    
    Expected output
    three o' clock
    
  3. Example 3

    Input
    7
    15
    
    Expected output
    quarter past seven
    
  4. Example 4

    Input
    12
    41
    
    Expected output
    nineteen minutes to one