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
xyyx
4
The strings which can be dervived from S by removing two characters are - xy, yy, yx, xy, yx, xx, yy.
Unique lucky strings from above are xy, yx, xx, yy. So we print 4
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
No editorial available for this problem.
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