An infinite periodic string is a string consisting of a non-periodic string *S* repeated infinitely, and is denoted as (*S*). For example, (ABC)=ABCABCABCA... Note that *S* must not be a repetition itself, so (ABAB)=ABABABAB... is not legal, and should be written as (AB)=ABABABAB... instead. *S* must contain only uppercase letters ('A'-'Z').
The sum of two infinite periodic strings is the string where each character is the sum of the corresponding characters in the two strings. Two characters are added as follows. Adding A to a character means changing it to the next character in the alphabet (where A is the next character after Z): A+A=B, A+B=C, A+C=D, ..., A+Y=Z, A+Z=A. Adding B to a character means changing it to the next character twice: B+A=C, B+B=D, B+C=E, ..., B+Z=B. All the other characters behave in the same manner (C means changing to the next character 3 times, D means 4, ..., Z means 26, so adding Z doesn't change a character).
The sum of two infinite periodic strings is itself an infinite periodic string. For example, (YAAZZB)=(AB)+(XYZ).
Given three integers, **sum**, **op1** and **op2**, return an example of such an addition formatted as "(*S*)=(*P*)+(*Q*)" (quotes for clarity only), where *S* contains exactly **sum** characters, *P* contains exactly **op1** characters, and *Q* contains exactly **op2** characters. Remember that *S*, *P* and *Q* each need to be non-periodic.
If there are several possible answers, return the one among them where *S* comes earliest alphabetically. If there is a tie, return the answer among the ties where *P* comes earliest alphabetically. If there is no solution, return "NO SOLUTION" (quotes for clarity only). |