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|S|105

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 109+7.

Sample Input

Copy
dmoj

Sample Output

Copy
16

Comments

There are no comments at the moment.