import java.util.*;

/**
 * This class shows the use of helper methods.
 */ 
public class HelperExample { 
  
  /**
   * Reverses the characters in the given
   * String.
   * @param s A string of characters.
   * @return The reversed string of characters.
   */ 
  public static String reverse(String s) {
    String result = "";
    int i = s.length() - 1;
    
    while(i >= 0) {
      result += s.charAt(i);
      i--;
    }
    return result;
  }
  
  /**
   * Return the given sentences with the
   * characters in each word reversed.
   */
  public static String revCharsInSent(String s) {
    String result;
    StringTokenizer st = new StringTokenizer(s, " .", true);
    
    // find each word
    for(int i = st.countTokens(); i > 0; i--) {
    
      // reverse each word
      // Call a helper method:
      result += reverse(st.nextToken());
      
    }
    return result;
  }
}
