Generates a key from given string . The key contains all unique characters of given string in sorted order consisting of only distinct elements .
string getKey ( string & str ) { bool visited [ MAX_CHAR ] = { false } ;