perl -lne 'chomp; undef %h; @p=split(//,$_); foreach $k (@p) { $h{$k}=$k; } print (sort keys(%h));' test-strings