import java.util.Scanner;//.toLowerCase() // try{ }catch(NumberFormatException e) input >= 'A' && input <= 'Z')
public class d086 {
static String A[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
static int a[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26};
public static void main(String[] args){
Scanner input=new Scanner(System.in);
while(input.hasNext()){
String word="";
word+=input.nextLine();
if(word.equals("0")){
break;
}else{
int grade=0;
for(int j=0;j<word.length();j++){
for(int i=0;i<a.length;i++){
if(String.valueOf(word.charAt(j)).equalsIgnoreCase(A[i]))
grade+=a[i];
}
}
System.out.println(grade);
}
}
}
}
想寫成不是輸入英文和"0"輸出"fail"