Find number of contiguous Substrings with repeated patterns
Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article
Given a string str consisting of digits, the task is to find the number of contiguous substrings such that the substring can be rearranged into a repetition of some string twice.Examples:Input: str=”15512212″Output: 6Explanation: Possible 6 substrings are : “1551” can be rearranged to “1515““155122” can be rearranged to “152152““551221” can be rearranged to “512512““1221” can be rearranged to “1212““55” can be rearranged to…