import java.util.HashMap; import java.util.Scanner; public class Main { private static final HashMap<Integer, String> numEngMap = new HashMap<Integer, String>(){{ put(1, "one"); put(2, "two"); put(3, "three"); put(4, "four"); put(5, "five"); put(6, "six"); put(7, "seven"); put(8, "eight"); put(9, "nine"); put(10, "ten"); put(11, "eleven"); put(12, "twelve"); put(13, "thirteen"); put(14, "fourteen"); put(15, "fifteen"); put(16, "sixteen"); put(17, "seventeen"); put(18, "eighteen"); put(19, "nineteen"); put(20, "twenty"); put(30, "thirty"); put(40, "forty"); put(50, "fifty"); put(60, "sixty"); put(70, "seventy"); put(80, "eighty"); put(90, "ninety"); put(100, "hundred"); }}; public static void main(String[] args){ Scanner in = new Scanner(System.in); while(in.hasNext()){ solution(in); } } /** * 模拟法 * @param in */ private static void solution(Scanner in){ long number = in.nextLong(); String numStr = String.valueOf(number); int numStrLen = numStr.length(); int times = numStrLen / 3; int remainder = numStrLen % 3; String[] units = new String[]{"", "thousand", "million", "billion"}; StringBuilder result = new StringBuilder(); // 从右到左 每3位数转换一次 for(int i=1; i<=times; i++){ result.insert(0, numToEng(Integer.parseInt(numStr.substring(numStrLen-i*3, numStrLen-(i-1)*3)))+units[i-1]+" "); } if(remainder > 0){ if(times == 0){ result.insert(0, numToEng(Integer.parseInt(numStr.substring(0, remainder)))); }else{ result.insert(0, numToEng(Integer.parseInt(numStr.substring(0, remainder)))+units[times]+" "); } } System.out.println(result); } /** * 三位数 转 英文 * @param num * @return */ private static String numToEng(int num){ StringBuilder sb = new StringBuilder(); // 百位 int hundredthDigit = num / 100; int hundredthRemainder = num % 100; if(hundredthDigit > 0){ sb.append(numEngMap.get(hundredthDigit) + " " + numEngMap.get(100) + " "); if(hundredthRemainder > 0){ sb.append("and "); } } // 十位及个位 if(hundredthRemainder > 0){ int tenthDigit = hundredthRemainder / 10; int tenthRemainder = hundredthRemainder % 10; // 10 20 30 40 50 60 70 80 90 if(tenthRemainder == 0){ sb.append(numEngMap.get(hundredthRemainder)).append(" "); }else{ // 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 if(tenthDigit <= 1){ sb.append(numEngMap.get(hundredthRemainder)).append(" "); }else{ sb.append(numEngMap.get(tenthDigit*10)).append(" "); sb.append(numEngMap.get(tenthRemainder)).append(" "); } } } return sb.toString(); } }