Rajiv's Lucky Strings
Practice
1 (1 votes)
Medium
Problem
3% Success 123 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Rajiv has a string S. He considers a string T lucky for him if he can derive it from S by removing exactly 2 characters. You being his best friend have to find out the number of unique lucky strings when a string S is given.

Input

The first line of the input contains a string S.

Output

You have to print the total number of unique lucky strings formed using S.

Constraints

3<=|S|<=106

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
Medium
Points:30
2 votes
Tags:
MediumDynamic programming
Points:30
6 votes
Tags:
Applications of Dynamic ProgrammingAlgorithmsDynamic Programming
Editorial

No editorial available for this problem.