Solution for Boolean in Java 8


Nov. 6, 2019 68.619657 seconds Java 8
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
            boolean notflag = false;
            String input = in.nextLine();
            
            String[] inList = input.split(" ");
            
            for(int i = 0; i < inList.length; i++){
                if(inList[i].equals("not")){
                    
                    notflag = !notflag;
                } else if(inList[i].equals("False")){
                    if(notflag){
                        System.out.println("True");
                    }else{
                        System.out.println("False");
                    }
                }else if(inList[i].equals("True")){
                    if(notflag){
                        System.out.println("False");
                    }else{
                        System.out.println("True");
                    } 
                
                
            }
               
            
    }
 
    }
  
    
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.