Group Shifted String
medium
1. You are given an array of strings. 2. You have to group the given strings in such a way that all strings in a group are shifted versions of each other. 3. Two strings s1 and s2 are shifted if - -> Length of both the strings is the same. -> The difference between ASCII values of every character of s1 and s2 is constant. Note -> Every string consists of lower-case English letters only.
Constraints
1 <= N <= 10^4 1 <= length of a string <= 100
Format
Input
A number N str1 str2.. N space-separated strings
Output
Every line of output contains space-separated strings which represents a group of shifted strings.
Example
Sample Input
9
acd dfg wyz yab mop bdfh a x moqs
Sample Output
acd dfg mop wyz yab
a x
bdfh moqs
Question Video