import java.util.*;
public class NestedForLoops {
  /** 
   * 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, ".");
    for (int i = 0,  count = st.countTokens();  i < count; i++) {  
      System.out.print(count + " " + i + " ");
      String temp = st.nextToken();
      System.out.println(temp);
      StringTokenizer st2 = new StringTokenizer(temp);
      // note the compound statement for the initialization step 
      // in the following for loop:
      for (int j = 0, count2 = st2.countTokens(); j < count2; j++) {
        System.out.print(count2 + " " + j + " ");
        String temp2 = st2.nextToken();
        System.out.println(temp2);
      }
    }
  }
  /** 
   * Reverse the order of the characters in 
   * String s.
   * @return the string of reversed characters.
   */
  public static String reverseChar(String s) {
    String s2 = "";
    for (int i = s.length() -1 ; i >= 0; i --) {
      s2 += s.charAt(i);
    }
    return s2;
  }
}
        
        
        
        
        
        
        
        
        
        
        
        
        
        
