Alperen strings s t initially equal he perform q operation type give string 1 k x Append string x exactly k times end string s in word s s underbracex dot x_k text times 2 k x Append string x exactly k times end string t in word t t underbracex dot x_k text time after operation determine possible rearrange character s t s lexicographically smallerdagger tNote string change perform operation do not initial statesdagger simply speak lexicographical order order word list dictionary a formal definition follow stre p lexicographically small string q exist position p_i q_i j p_j q_j if exist p lexicographically small q length p length q for example textttabdc textttabe textttabc textttabcd write p q p lexicographically small q