This code contain syntax and logical errors can someone help
Scanner scan = new Scanner(System); String message = "Enter a sentence: "; boolean valid = false; String input = ""; int indexOfFullStop = 0; int indexOfQuestion = 0; int indexOfExclamation = 0; int lastIndex = 0; do { System.out.print(message); input = scan.nextLine(); indexOfFullStop = input.indexOf('.'); indexOfQuestion = input.indexOf('?'); indexOfExclamation = input.indexOf('!'); if((indexOfFullStop != 0) && (indexOfQuestio!= 0) && (indexOfExclamation != 0)) { valid = true; if(indexOfFullStop != ‐1) { lastIndex = indexOfFullStop; } else { if(indexOfQuestion == ‐1) { lastIndex = indexOfQuestion; } else { lastIndex = indexOfExclamation; } } } else { message = "A sentence must end with a . OR ! OR ?" + "\nEnter a "\n