Itami has just received an encoded message of length from the army headquarters. As the army prefers simplicity, all their messages are encoded with the Caesar Cipher, and all encryption will be done with a right shift. Prior to departure, Itami had been given a secret document containing the different shifts that will be used for each day. Unfortunately, being an airhead, he has lost the document.
Fortunately, Itami knows that every decrypted message will always contain the army's motto. Given the encoded message and the army's motto , please help Itami figure out the minimum possible nonnegative right shift used in the encryption, as well as the decrypted message.
Input Specification
The only two lines of input will contain strings and respectively, both containing only lowercase letters. It is guaranteed that .
Output Specification
The first line of output should contain the shift used in the encryption . It is guaranteed that at least one exists. If there are multiple possible shifts, output the smallest. The second line should contain the decrypted message, using the correct shift.
Sample Input 1
lfyjhttqfsnrjgwt
gate
Sample Output 1
5
gatecoolanimebro
Sample Input 2
owwltcksocga
odl
Sample Output 2
8
goodluckguys
Sample Input 3
uggcpbybafynfufynfujjjqbgzcsbhehcybnqqbgpbzfynfuwdccnsvirbcbjfe
httpcolonslashslash
Sample Output 3
13
httpcolonslashslashwwwdotmpfouruploaddotcomslashjqppafiveopowsr
Comments