<s> class ValidWordAbbr ( object ) : <EOL> def __init__ ( self , dictionary ) : <EOL> """<STR_LIT>""" <EOL> self . lookup_ = collections . defaultdict ( set ) <EOL> for word in dictionary : <EOL> abbr = self . abbreviation ( word ) <EOL> self . lookup_ [ abbr ] . add ( word ) <EOL> def isUnique ( self , word ) : <EOL> """<STR_LIT>""" <EOL> l = len ( word ) <EOL> abbr = self . abbreviation ( word ) <EOL> return self . lookup_ [ abbr ] <= { word } <EOL> def abbreviation ( self , word ) : <EOL> return word [ <NUM_LIT:0> ] + str ( len ( word ) ) + word [ - <NUM_LIT:1> ] </s>
