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 N (≤10100).
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:
<span style="color:#212529"><code class="language-in">12345</code></span>
结尾无空行
Sample Output:
<span style="color:#212529"><code class="language-out">one five</code></span>
结尾无空行
#include <iostream>
using namespace std;
int main()
{
string num;
string number[10] = {"zero","one","two","three","four","five","six","seven","eight","nine"};
cin >> num;
int S = 0;
for (int i = 0;num[i];i++) S += (num[i]-48);
string num1 = to_string(S);
int length1 = num1.length();
for (int i = 0;i < length1;i++)
{
if (i == length1 - 1) cout << number[num1[i]-48];
else cout << number[num1[i]-48] << " ";
}
return 0;
}