Mock CCC '21 S2 - Colorful Strings

View as PDF

Submit solution


Points: 7 (partial)
Time limit: 0.25s
Memory limit: 1G

Problem type

A string is colorful if every letter appears at most once in the string.

Given a string, count with multiplicity the number of subsequences which are colorful.

Constraints

1 \le |S| \le 10^5

Input Specification

The input is a string S on a single line consisting of only lowercase letters.

Output Specification

Output the number of colorful subsequences modulo 10^9 + 7.

Sample Input

dmoj

Sample Output

16

Comments

There are no comments at the moment.