#!perl map{chomp;push@{$t{join"",sort/(.)/g}},$_}<>;push@{$r[@$_]},"@{[sort@$_]} "for%t;print grep{/ /}sort@$_ for@r;