#Bash + GNU utilities, 58 <!-- language-all: lang-bash --> f()(tr -dc \ <<<${@^^}|fold -1|sort) f $1|cmp -s - <(f $2)