#include <iostream>
#include <string>
#include <vector>
using namespace std;
// 处理 0 - 19 的英文表述
const string ones[] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen",
"seventeen", "eighteen", "nineteen"};
// 处理 20, 30, ..., 90 的英文表述
const string tens[] = {"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
// 处理千、百万、十亿等单位
const string thousands[] = {"", "thousand", "million", "billion"};
// 处理 0 - 999 的英文表述
string convertHundreds(int num) {
string result;
if (num >= 100) {
result += ones[num / 100] + " hundred";
num %= 100;
if (num) {
result += " and ";
}
}
if (num < 20) {
result += ones[num];
} else {
result += tens[num / 10];
if (num % 10) {
result += " " + ones[num % 10];
}
}
return result;
}
// 处理整个数字的英文表述
string numberToWords(int num) {
if (num == 0) return "zero";
string result;
int i = 0;
while (num > 0) {
if (num % 1000) {
if (!result.empty()) {
result = " " + result;
}
result = convertHundreds(num % 1000) + (i ? " " + thousands[i] : "") + result;
}
num /= 1000;
i++;
}
return result;
}
int main() {
int n;
cin >> n;
cout << numberToWords(n) << endl;
return 0;
}
/**************************************************************
Problem: 1126
User: chenmingyu
Language: C++
Result: Accepted
Time:8 ms
Memory:2080 kb
****************************************************************/