Driver code
public static void main ( String [ ] args ) { ArrayList < String > A = new ArrayList < > ( ) ; A . add ( " ABAB " ) ; A . add ( " ABF " ) ; A . add ( " CDA " ) ; A . add ( " AD " ) ; A . add ( " CCC " ) ;