Can anybody help me to resolve problem ?
package com.codegym.task.task05.task0529;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Console-based piggy bank
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
int num = 0;
String x = br.readLine();
while(true){
int total = Integer.parseInt(x);
String s = br.readLine();
if(s.equals("sum")){
System.out.println(num + total);
break;
}
else{
num +=total;
}
}
}
}