a = gets.chomp.split("") a = a.permutation.to_a a.uniq! p a.size - 1