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 ) { bool [ ] visited = new bool [ MAX_CHAR ] ;