// Allison Obourn
// CS& 141, Winter 2021
// Lecture 8

// This program prompt the user for words until the user types quit
// then it prints out the number of characters the user typed in. 

import java.util.*;

public class SentinelLoop {
   public static void main(String[] args) {
      Scanner console = new Scanner(System.in);
      int sum = 0;
      System.out.print("Type a word (or \"quit\" to exit): ");
      String word = console.next();

      while (!word.equals("quit")) {
         sum += word.length();
         System.out.print("Type a word (or \"quit\" to exit): ");
         word = console.next();
      }
      System.out.println("You typed a total of " + sum + " characters.");
   }
}