const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; const map = { 1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 10: 'ten', 11: 'eleven', 12: 'twelve', 13: 'thirteen', 14: 'fourteen', 15: 'fifteen', 16: 'sixteen', 17: 'seventeen', 18: 'eighteen', 19: 'nineteen', 20: 'twenty', 30: 'thirty', 40: 'forty', 50: 'fifty', 80: 'eighty' } function getTwo(first, second) { let num = first + second if (num >= 10 && num < 20) { return map[num]; } else { if (first-0) { let res = '' if ([2, 3, 4, 5, 8].includes(first-0)) { res = `${map[first*10]} ${second > 0 ? map[second] : ''}` } else { res = `${map[first]}ty ${second > 0 ? map[second] : ''}` } return res } else { return map[second] } } } function getThree(first, second, third) { return `${first-0 ? map[first] + ' hundred ' : ''}${(first-0 && (second-0 || third-0) ? 'and ' : '')}${(second-0 || third-0 ) ? getTwo(second, third) : ''}` } function getFour(second, third, fourth) { return `thousand ${getThree(second, third, fourth)}` } void async function () { // Write your code here while(line = await readline()){ let len = line.length let res = '' let [first, second, third, fourth, fifth, sixth, seventh] = line.split('') switch(len) { case 1: res = map[line]; break; case 2: res = getTwo(first, second) break; case 3: res = getThree(first, second, third) break; case 4: res = `${map[first]} ${getFour(second, third, fourth)}` break; case 5: res = `${getTwo(first, second)}${getFour(third, fourth, fifth)}` break; case 6: res = `${getThree(first, second, third)} ${getFour(fourth, fifth, sixth)}` break; case 7: res = `${map[first]} million ${getThree(second, third, fourth)} ${getFour(fifth, sixth, seventh)}` break; default: break } console.log(res) } }()