package com.codegym.task.task05.task0529; import java.io.BufferedReader; import java.io.InputStreamReader; /* Console piggy bank */ public class Solution { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int sum = 0; boolean isExit = false; while(!isExit) { String s = reader.readLine(); isExit = s.equals("sum"); int n = Integer.parseInt(s); sum = sum+n; } System.out.println(sum); } }