AtCoder Grand Contest 031
A
Colorful Subsequence
AtCoder
⌀ 953
原题
←B →
翻译中…

Problem Statement

翻译中…

You are given a string $S$ of length $N$. Among its subsequences, count the ones such that all characters are different, modulo $10^9+7$. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.

翻译中…

Here, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 100000$
  • $S$ consists of lowercase English letters.
  • $|S|=N$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
S

翻译中…

Output

翻译中…

Print the number of the subsequences such that all characters are different, modulo $10^9+7$.

翻译中…

样例

Input #1
4
abcd
Output #1
15
Since all characters in $S$ itself are different, all its subsequences satisfy the condition.
Input #2
3
baa
Output #2
5
The answer is five: `b`, two occurrences of `a`, two occurrences of `ba`. Note that we do not count `baa`, since it contains two `a`s.
Input #3
5
abcab
Output #3
17
题目信息
题号
agc031_a
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。