A. Juggling Letters SOLUTIONS

Juggling Letters SOLUTION Codeforces

You are given n strings s1,s2,… ,sn comprising of lowercase Latin letters. 
In one activity you can eliminate a character from a string si and addition it to a self-assertive situation in a string sj (j might be equivalent to I). You may play out this activity quite a few times. Is it conceivable to make all n strings equivalent? 
 
Info 
 
The main line contains t (1≤t≤10): the quantity of experiments. 
 
The primary line of each experiment contains a solitary whole number n (1≤n≤1000): the quantity of strings. 
 
n lines follow, the I-th line contains si (1≤|si|≤1000). 
 
The total of lengths of all strings in all experiments doesn’t surpass 1000. 
 
Yield 
 
In the event that it is conceivable to make the strings equivalent, print “YES” (without cites). 
 
Something else, print “NO” (without cites). 
 
You can yield each character in either lowercase or capitalized. 
 
Model 
 
inputCopy 
 
 
 
caa 
 
cbb 
 
 
cba 
 
cba 
 
cbb 
 
 
ccab 
 
cbac 
 
bca 
 
acbcc 
 
 
acb 
 
caf 
 
 
cbafc 
 
outputCopy 
 
Indeed 
 
NO 
 
Indeed 
 
NO 
 
Note 
 
In the primary experiment, you can do the accompanying: 
 
Eliminate the third character of the principal string and addition it after the second character of the subsequent string, making the two strings “ca” and “cbab” individually. 
 
Eliminate the second character of the subsequent string and supplement it after the second character of the principal string, making the two strings equivalent to “taxi”. 
 
In the subsequent experiment, it is difficult to make all n strings equivalent.

1 thought on “A. Juggling Letters SOLUTIONS”

Leave a Comment