Split the Str Ing codechef October Cook off challenge solution -
You are given a string with length . Determine if it is possible to find two non-empty strings and which satisfy the following conditions:
- , where denotes string concatenation
- is a substring of
Note: is a substring of if can be obtained from by deleting several (possibly zero) characters from the beginning and several (possibly zero) characters from the end. For example, "ab" is a substring of "cabd", but "ad" is not.
- The first line of the input contains a single integer denoting the number of test cases. The description of test cases follows.
- The first line of each test case contains a single integer .
- The second line contains a single string .
For each test case, print a single line containing the string
"YES" if it is possible to find strings and