import java.util.Scanner; public class SentenceCount { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String sentence; System.out.println("Enter a sentence:"); sentence = keyboard.next(); if (sentence endsWith ?) && (sentence length%2==0) System.out.println("YES"); else if (sentence endsWith ?) System.out.println("NO"); else if (sentence endsWith !) System.out.println("WOW"); else System.out.println("You always say " + sentence); } }