public static void main(String args[]) {
    // read file here and store fragments as arraylist
    String filename = "fragments.txt";
    ShortestCommonSuperstring scs = new ShortestCommonSuperstring();

    try {
      FileReader inputStream = new FileReader(filename);
      BufferedReader inputDocument = new BufferedReader(inputStream);
      String inputLine;

      while ((inputLine = inputDocument.readLine()) != null) {
        scs.fragments.add(inputLine);
        scs.numberOfFragments++;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    int mergedStringIndex = -1;
    int fragmentLength = scs.fragments.get(0).length();

    for (int i = 0; i < scs.numberOfFragments; i++) {
      scs.calculateOverlaps(fragmentLength);
      if (scs.maxOverlap == 0) {
        break;
      }
      mergedStringIndex = scs.mergeStrings(fragmentLength);
    }
    //		System.out.println(scs.fragments.get(0));
    //		System.out.println("Index : "+mergedStringIndex);

    System.out.println(
        "Shortest Common SuperString : " + scs.fragments.get(mergedStringIndex) + "\n");
  }
  public static void main(String arg[]) {
    Set<String> fragments = new HashSet<String>();
    ShortestCommonSuperstring superStringCreator = new ShortestCommonSuperstring();

    fragments.add("abdul");
    fragments.add("apple");
    fragments.add("mango");
    fragments.add("orange");
    fragments.add("banana");

    /* find the shortest super string */
    superStringCreator.createSuperString(fragments);
  }