import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
public class Solution {
static long maximumProgramValue(int n) {
long x=0l,y=0l;
long count=0l;
while(n!=0) {
String s=scanner.nextLine();
if(s.next().equals("add")) {
y=s.nextLong();
x=x+y;
} else {
y=s.nextLong();
}
if(count < x)
count=x;
n--;
}
return count ;
}
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
int n = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])*");
long result = maximumProgramValue(n);
bufferedWriter.write(String.valueOf(result));
bufferedWriter.newLine();
bufferedWriter.close();
scanner.close();
}
}
I am getting this error please help
Solution.java:21: error: cannot find symbol
if(s.next().equals("add"))
^
symbol: method next()
location: variable s of type String
Solution.java:23: error: cannot find symbol
y=s.nextLong();
^
symbol: method nextLong()
location: variable s of type String
Solution.java:28: error: cannot find symbol
y=s.nextLong();
^
symbol: method nextLong()
location: variable s of type String
3 errors
Exit Status