public static void main (String[] args)
  {
      String phrase = "";    // a string of characters
      int length;       // the length of the phrase
      char ch;          // an individual character in the string

	Scanner scan = new Scanner(System.in);

      // Print a program header
      System.out.println ();
      System.out.println ("Character Counter");
      System.out.println ();
      
      while (true)
      {
          // Read in a string and find its length
    	  System.out.print ("Enter a sentence or phrase or \'quit\' to stop: ");
          phrase = scan.nextLine();
          
          //terminates process when user enters 'quit'
          if (phrase.equals("quit"))
          {
        	  break;
          }
          
          length = phrase.length();
    	  int countBlank=0, countA=0, countE=0, countS=0, countT=0;   // the number of blanks (spaces) in the phrase 
      



          // a for loop to go through the string character by character
          for  (int currentChar=0; currentChar < length; currentChar++)
          {
    	    ch = phrase.toLowerCase().charAt(currentChar);
    	    switch (ch)
	    	{
	    	case ' ': countBlank++;
	    		break;
	    	case 'a': countA++;
	    		break;
	    	case 'e': countE++;
	    		break;
	    	case 's': countS++;
	    		break;
	    	case 't': countT++;
	    		break;
	    	}
          }

	      // Print the results
	      System.out.println ();
	      System.out.println ("Number of blank spaces: " + countBlank);
	      System.out.println ("Number of a's: " + countA);
	      System.out.println ("Number of e's: " + countE);
	      System.out.println ("Number of s's: " + countS);
	      System.out.println ("Number of t's: " + countT);
	      System.out.println ();
      }
  }