[Solution] Copy and Push Back CodeChef Solution
Anton loves creating strings!
Anton now wants to create a string following some specific rules. They are as follows:
Initially, is empty. Then, Anton can perform two types of operations on :
- Choose a lowercase Latin character (an element of ) and append it to . For example, if currently , Anton can turn it into one of .
- Append a copy of to itself. For example, if currently , Anton can turn it into .
However, Anton doesn't want to perform operation twice in a row.
👇👇👇👇👇
You are given a string consisting of the lowercase Latin alphabet. Is it possible for Anton to create using his operations any number of times?
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two lines of input.
- The first line of each test case contains a single integer , the length of the string .
- The second line of each test case contains a string of length .
Output Format
For each test case, output on a new line the answer — YES
if Anton can create using his operations, and NO
otherwise.
Each character of the output may be printed in either uppercase or lowercase. For example, the strings YES
, yes
, and YeS
will all be treated as identical.
Constraints
- consists of only lowercase Latin characters
- The sum of across all test cases won't exceed
No comments:
Post a Comment