## Split the Str Ing codechef October Cook off challenge solution -

## Problem Statement-

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.

### Input

- 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 .

### Output

For each test case, print a single line containing the string `"YES"`

if it is possible to find strings and satisfying the given conditions or `"NO"`

otherwise (without quotes).

### Constraints

- contains only lowercase English letters
- the sum of over all test cases does not exceed

### Example Input

```
5
6
cabdab
21
yourcrushlovesyouback
16
wubbalubbadubdub
5
split
7
splitit
```

### Example Output

```
YES
NO
YES
NO
YES
```

### Explanation

Example case 1: We can choose "cabd" as and "ab" as . We can see that and is a substring of .

Example case 2: It is impossible to find two strings which satisfy the constraints. For example, when is "yourcrushlovesyou" and is "back", then , but is not a substring of .

Example case 3: We can choose "wubbalubbadub" as and "dub" as .

Problem link=https://www.codechef.com/COOK123B/problems/SPLITIT

Join Telegram For Competetive Programming Guide and Update-https://t.me/competitiveProgrammingDiscussion

### Split the Str Ing codechef solution-

I will check only for last charter of string S if it is present in A I will Print Yes Otherwise I will Print NO.

## Comments

## Post a Comment