Nathan Coulas

Boolean

boolean JAVA8 06 Nov, 2019 68.620s 4 points

Source Code

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");
                    } 
                
                
            }
               
            
    }
 
    }
  
    
}