834. Unique Substring

0

Hard

Vatsal has been assigned a task by his instructor to calculate the sum of all the unique characters in all possible substrings of a given string.

Input Format

A string.

Output Format

Output the sum as required.

Example

Input

ABC

Output

10

Constraints

1 <= s.length <= 10^5
Loading...

View Submissions

Console