import java.util.*;

public class NestedLoops {
  
  /** 
   * Split s into sentences, printing
   * a header for each sentence, and each
   * word in the sentence on a separate
   * line.
   */
  public static void sentenceWordSplit(String s) {
    StringTokenizer st = new StringTokenizer(s, ".");
    int i = 1;
    
    // for each sentence
    while(st.hasMoreTokens()) {
      StringTokenizer st2 = 
        new StringTokenizer(st.nextToken().trim(), " ");
      
      System.out.println("Sentence " + i);
      
      // for each word in the sentence
      while(st2.hasMoreTokens()) {
        System.out.println(st2.nextToken());
      }
      i++;
    }   
  }
  
  /**
   * What is the output of this method?
   */ 
  public static void example() {
    for(int i = 0; i < 4; i++) {
      for(int j = 0; j < 2; j++) {
        System.out.print(j + " ");
      }
      System.out.println();
    }
  }
  
  
  /**
   * How many times does the outer loop execute?
   */
  public static void example2() {
    int i = 0;
    while(i <= 3) {
      for(int j = 1; j < 2; j++) {
        if(i == j) {
          i++;
        }
      } 
      i++;
    }
  }
}
