Generates a key from given string . The key contains all unique characters of given string in sorted order consisting of only distinct elements .
static String getKey ( String str ) { boolean [ ] visited = new boolean [ MAX_CHAR ] ; Arrays . fill ( visited , false ) ;