/**
* @param args
*/
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
int ch = 0;
int pos = 0;
String str = null;
byte[] buf = new byte[1024];
System.out.println("Please input info");
while(true){
ch = System.in.read();
switch (ch) {
case '\r':
break;
case '\n':
str = new String(buf,0,pos);
// String a[] = str.split("");
Pattern p = Pattern.compile("[0-9]");
Matcher m = p.matcher(str);
int result = 0;
while(m.find()) {
int temp = Integer.parseInt(m.group());
result = result + temp;
}
// String a[] = str.
/*int result = 0;
for (int i = 0; i < a.length; i++) {
int temp = Integer.parseInt(a);
result = result + temp;
}*/
System.out.println(result);
pos = 0;
break;
default:buf[pos++] = (byte)ch;
break;
}
}