code: private static int add(int set[], StringBuffer str)
      {
          int result = str.length();
  
          for (int i = result - 1; i >= 0; i --) {
              add(set, str.charAt(i));
          }
          return result;
      }
docs: Adds all characters of the argument str and gets the length
  Equivalent to calcStringSetLength.
  @param set set to add all chars of str to
  @param str string to add