import java.util.*;

public class NestedLoops {
 
  /**
   * Split s into sentences, printing a header for
   * each sentence, and each word in the sentence
   * on a different line.
   * 
   * "Today is Thursday. It's almost the end of the week."
   * 
   * Sentence 1:
   * Today
   * is 
   * Thursday
   * Sentence 2:
   * It's
   * almost
   * the
   * end
   * of
   * the
   * week
   */ 
  public static void sentenceWordSplit(String s) {
    
    // split the String into sentences
    StringTokenizer st = new StringTokenizer(s, ".");
    int sentenceNo = 1;
    
    // for each sentence
    while (st.hasMoreTokens()) {
      
      // print the sentence number
      System.out.println("Sentence " + sentenceNo + ":");
      String sent = st.nextToken();
      
      // split the sentence into words
      StringTokenizer st2 = new StringTokenizer(sent);
      
      // for each word in the sentence
      while (st2.hasMoreTokens()) {
        //print the word
        System.out.println(st2.nextToken());
      }
      sentenceNo++;
    }
  }
}