code: public static ArrayList<Integer> getSiblingsOf(int[] parents, int idx) {
          int parent = parents[idx];
          ArrayList<Integer> siblings = new ArrayList<Integer>();
          for (int i=0; i<parents.length; i++) {
              if (parents[i] == parent) {
                  siblings.add(i);
              }
          }
          return siblings;
      }
docs: Gets the siblings of the specified word.
  @param parents The parents array.
  @param idx The word for which to extract siblings.
  @return The indices of the siblings.