Anyone know how to solve this???
A 8-years old boy was learning to play Piano. He played several musical notes that are combination of ‘C’, ‘D’, ‘E’, ‘F’, ‘G’. For example, he played "CCGCCGGCCG" on the Piano.
He wants to identify repeated sequences within his played musical notes.
Given a string s that represents a sequence of musical notes, write a program to return all the 10-letter-long sequences (substrings) that occur more than once in the s. You may return the answer in any order.
Example 1:
Input: s = "CCCCCDDDDDCCCCCDDDDDCCCCCFFGG" Output: CCCCCDDDDD
CCCCDDDDDC CCCDDDDDCC CCDDDDDCCC CDDDDDCCCC DDDDDCCCCC
Example 2:
Input: s = "CCCCCCCCCCCCC"
Output: CCCCCCCCCC