Polycarp can just settle one errand during the day. Consistently he recorded what task he tackled. Presently the educator needs to know whether Polycarp followed his recommendation. For instance, assuming Polycarp tackled errands in the accompanying request: "DDBBCCCBBEZ", the educator will see that on the third day Polycarp started
Correct answer will be upvoted else downvoted.
Polycarp can just settle one errand during the day. Consistently he recorded what task he tackled. Presently the educator needs to know whether Polycarp followed his recommendation.
For instance, assuming Polycarp tackled errands in the accompanying request: "DDBBCCCBBEZ", the educator will see that on the third day Polycarp started to settle the assignment 'B', then, at that point, on the fifth day he got occupied and started to address the undertaking 'C', on the eighth day Polycarp got back to the assignment 'B'. Different instances of when the educator is dubious: "BAB", "AABBCCDDEEBZZ" and "AAAAZAAAAA".
Assuming Polycarp addressed the errands as follows: "FFGZZZY", the educator can't have any doubts. Kindly note that Polycarp isn't committed to settle all errands. Different instances of when the instructor doesn't have any dubious: "BA", "AFFFCC" and "YYYYY".
Assist Polycarp with seeing whether his educator may be dubious.
Input
The main line contains an integer t (1≤t≤1000). Then, at that point, t experiments follow.
The principal line of each experiment contains one integer n (1≤n≤50) — the number of days during which Polycarp addressed assignments.
The subsequent line contains a line of length n, comprising of capitalized Latin letters, which is the request wherein Polycarp tackled the assignments.
Output
For each experiment output:
"Indeed", if the instructor can't be dubious;
"NO", in any case.
You might print each letter regardless you need (along these lines, for instance, the strings yEs, indeed, Yes and YES are totally perceived as sure reply).
Step by step
Solved in 4 steps with 1 images