1.Given a string s
2.Find out the count of all contiguous substrings whose starting and ending are same character.
3.Note: string contains lowercase English alphabets only.
4.You have to complete the function count() which should return the count of all such substrings.
Input Format
Single line containing a string S.
Output Format
Return the count of all the substrings whose first and last character are same.
Constraints
1<=Length of string<=10^4
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
abcab
Output
7