beecrowd | 3313

Wordplay

By Abner Samuel P. Palmeira, Instituto Federal do Sul de Minas Gerais BR Brazil

Timelimit: 1

Amigoum and Amigodois are longtime friends and both love strings, they recently learned about rotating a string. Rotating a string consists of putting the last letter at the beginning of it. For example the ROTA string when rotated becomes AROT, and if it is rotated again we will have the TARO string. Amigoum and Amigodois found a beautiful string on the ground, and now they want to rotate that string.

Amigoum wants to rotate the string so that it is the smallest lexicographical string, and Amigodois wants to rotate it so that it is the largest lexicographical string. Your task is to implement for your friends an algorithm that, given a string S, displays its smallest and largest lexicographical rotation.

Input

There are several test cases. The input of each test case is given in several lines, containing a non-empty string of maximum 10characters that represents the string of friends. Each character in the string can be a lowercase letter. The last test case is followed by a line containing a single asterisk.

Output

For each test case print "Caso x:"followed by the smallest and largest string that friends can form.

Input Sample Output Sample

eart

rato

*

Caso 1: arte tear

Caso 2: ator tora