Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.

Input Specification:

Each input file contains one test case. Each case occupies one line which contains an .

Output Specification:

For each test case, output in one line the digits of the sum in English words. There must be one space between two consecutive words, but no extra space at the end of a line.

Sample Input:

12345

Sample Output:

one five

Solve

数最多有100位,故只能使用字符串来存储,让我们把每位数相加的和,再单独一位一位以英语数打印出来,可以先制定一个数字到英语数的对应关系数组。

#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
 
vector<string> toEng = {"zero","one", "two","three","four","five","six","seven","eight","nine"};
 
int main() {
    string s;
    int sum = 0;
    cin >> s;
    for(int i = 0; i < s.size();i ++) {
        int num = s[i] - '0';
        sum += num;
    }
    // cout << sum << endl;
    s = to_string(sum);
    for(int i = 0; i < s.size(); i++) {
        cout << toEng[s[i] - '0'] << " \n"[i == s.size() - 1];
    }
 
    return 0;
}