// Tyler Rigsby, CSE 142 // Reads a series of words from the user, until they type 'quit' // and reports the count of the characters they typed import java.util.*; public class WordSum { public static final String SENTINEL = "quit"; public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("enter a word or 'quit' to quit: "); String next = console.next(); int count = 0; // for loop - definite loop // while loop - indefinite loop while (!next.equals(SENTINEL)) { count += next.length(); System.out.print("enter a word or 'quit' to quit: "); next = console.next(); } System.out.println("Number of letters: " + count); } }