Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created April 18, 2019 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/d2b19d50520116a48eea0adb6bc8d72d to your computer and use it in GitHub Desktop.
Save whatalnk/d2b19d50520116a48eea0adb6bc8d72d to your computer and use it in GitHub Desktop.
AtCoder AGC #031 A - Colorful Subsequence
n = gets.chomp.to_i
s = gets.chomp
h = Hash.new(0)
n.times do |i|
h[s[i]] += 1
end
MOD = 10**9 + 7
ans = 1
h.each do |k, v|
ans *= (v + 1)
ans %= MOD
end
puts ans - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment