import java.util.Scanner; import java.util.regex.Pattern; import java.util.regex.Matcher; public class AllNumber{ public static void main(String... args){ Scanner scan = new Scanner(System.in); String target = scan.next(); String[] number = target.split(""); for(int i = 0; i < number.length; i++){ if(isNumber(number[i])){ continue; }else{ number[i] = "not"; } } System.out.println(allPlus(number)); } public static boolean isNumber(String str){ String regex = "[0-9]"; Pattern p = Pattern.compile(regex); Matcher m = p.matcher(str); return (m.find())?true:false; } public static int allPlus(String[] numberList){ int result = 0; for(String str : numberList){ if(str.equals("not")){ continue; } result += Integer.parseInt(str); } return result; } }