# PAT (Advanced Level) Practice 1005 Spell It Right（简单的字符串处理）

Spell It Right

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.

Specification Input

Each input file contains one test case. Each case occupies one line which contains an N (≤10^100)

Specification Output.

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


AC代码：

#include <stdio.h>
#include <string.h>

int main(){
char s[105];
char e[10][10] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
scanf("%s", s);
int sum = 0, len = strlen(s);
for(int i = 0; i < len; i++) sum += s[i] - '0';
if(sum >= 100) printf("%s ", e[sum / 100]);
if(sum >= 10) printf("%s ", e[(sum / 10) % 10]);
printf("%s", e[sum % 10]);
return 0;
}


End

01-19 79

01-15