INFINITE STRING

Given a string of lowercase alphabets A of size N.

Find and return the number of substrings in A having more than 1 distinct alphabets % 10^7.



Input Format

The first argument given is string A.

Output Format

Return the number of substrings in A having more than 1 distinct alphabets % 10^7.

Constraints

1 <= N <= 100000

For Example

Input 1:
    A = "abcd"
Output 1:
    6

Input 2:
    A = "abcde"
Output 2:
    10
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving INFINITE STRING on Interview Code Editor
Sign Up
to access hints and editorial solutions for INFINITE STRING

Discussion


Loading...
Click here to start solving coding interview questions