• + 0 comments

    ruby:

    def solve(s)
        counts = s.split('').group_by{|x|x}.values.map{|v| v.size/2}
        (1..counts.sum).reduce(:*)/(counts.map{|c| (1..c).reduce(:*) || 1}.reduce(:*))%(10**9+7)
    end