题目描述
JAVA版本
样例
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
scanner.close();
int sum = 0;
for (int i = 0; i < s.length(); i++) {
sum += s.charAt(i)-'0';
}
String[] numArr = new String[]{"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
String sumStr = sum + "";
String res = numArr[sumStr.charAt(0) -'0'];
for (int i = 1; i < sumStr.length(); i++) {
int c = sumStr.charAt(i) -'0';
res = res + " " + numArr[c];
}
System.out.println(res);
}
}