import java.util.Scanner ;
public class Main {
try ( Scanner in
= new Scanner
( System .
in ) ) { while ( in.hasNext ( ) ) {
String [ ] line
= in.
nextLine ( ) .
split ( ":" ) ; }
}
}
public static String convert
( int hour,
int min
) { boolean am;
if ( hour< 12 ) {
am= true ;
if ( hour== 0 ) hour = 12 ;
} else {
am= false ;
if ( hour != 12 ) hour-= 12 ;
}
if ( min == 0 ) {
if ( hour
== 12 ) return String .
format ( "It's %s" , am
? "midnight" : "noon" ) ; else return String .
format ( "It's %s o'clock %s" , intToText
( hour
) , am
? "am" : "pm" ) ; }
else if ( min
== 30 ) return String .
format ( "It's half past %s %s" , intToText
( hour
) , am
? "am" : "pm" ) ; else if ( min
== 15 ) return String .
format ( "It's quarter past %s %s" , intToText
( hour
) , am
? "am" : "pm" ) ; else if ( min
== 45 ) return String .
format ( "It's quarter til %s %s" , intToText
( ( hour
== 12 ) ? 1 : hour
+ 1 ) ,
( ( hour
== 11 ) ?! am
: am
) ? "am" : "pm" ) ; else return String .
format ( "It's %s %s %s" , intToText
( hour
) ,
( ( ( min
< 10 && min
> 0 ) ? ( "oh " ) : ( "" ) ) + intToText
( min
) ) ,am
? "am" : "pm" ) ; }
private static String intToText
( int number
) { if ( number < 20 ) return onesNames[ number] ;
else {
int tens = number/ 10 ;
int ones = number% 10;
if ( ones== 0 ) return tensNames[ tens] ;
else return tensNames[ tens] + " " + onesNames[ ones] ;
}
}
private static final String [ ] tensNames
= { "" ,
"ten" ,
"twenty" ,
"thirty" ,
"forty" ,
"fifty" ,
"sixty" ,
"seventy" ,
"eighty" ,
"ninety" } ; private static final String [ ] onesNames
= { "" ,
"one" ,
"two" ,
"three" ,
"four" ,
"five" ,
"six" ,
"seven" ,
"eight" ,
"nine" ,
"ten" ,
"eleven" ,
"twelve" ,
"thirteen" ,
"fourteen" ,
"fifteen" ,
"sixteen" ,
"seventeen" ,
"eighteen" ,
"nineteen" } ; }
aW1wb3J0IGphdmEudXRpbC5TY2FubmVyOwpwdWJsaWMgY2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