0% found this document useful (0 votes)
50 views1 page

Problem B. Baker$: Input

Baker and Iris are friends who communicate through encrypted letters since Iris moved away. To encrypt, Iris takes the string, adds "$" to the end, rotates the string lexicographically, and the encrypted string is the last characters of each rotation. The input is several test cases with encrypted strings, and the output should be the decrypted strings for each test case.

Uploaded by

Samuel Franco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views1 page

Problem B. Baker$: Input

Baker and Iris are friends who communicate through encrypted letters since Iris moved away. To encrypt, Iris takes the string, adds "$" to the end, rotates the string lexicographically, and the encrypted string is the last characters of each rotation. The input is several test cases with encrypted strings, and the output should be the decrypted strings for each test case.

Uploaded by

Samuel Franco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Programming Contest 12 - Gran Premio ACM México CA - Repechaje, October 21st, 2017

Problem B. Baker$
Source file name: B.c, B.cpp, B.java, B.py
Input: Standard
Output: Standard

Baker and Iris are really good friends. Last month Iris moved out of the city and now their only way to
communicate is using letters. As both Baker and Iris are cats, their each of their letters contains a single
string of N characters. In order to create a more secure way of communication, Iris decided that she will
encrypt the messages that sends to Baker using the following procedure:
First add the character $ at the end of the string, next she will create all rotations of the string in
lexicographical order.Consider the character $ is the lowest lexicographically. The encrypted string is
made taking the last character of each rotation.

Your task is to help Baker to decrypt the letter Iris has sent.

Input
The input consists of several test cases. Each test case consists of a line with a string S that contains
only lower case characters and the $ symbol.

• 1 ≤ |S| ≤ 1000

Output
For each test case print in one line the decrypted message.

Example
Input Output
rb$kae baker
annb$aa banana

www.redprogramacioncompetitiva.com/ Twitter: @RedProgramacion


Page 2 of 17

You might also like