Programming contests

DEIK Regionális Programozó Csapatverseny, egyetemi kategória, 2022. december 4.

December 4, 2022, 10:00 AM – December 4, 2022, 3:15 PM

message

We got an encrypted message, that we want to decrypt of course. We learned the way of the encryption: take the string S to be encrypted and the (empty) string T="". As long as S is non-empty, we delete its leftmost character, and put it at the end of T and we reverse T. Here is the process for the string S="abc":

       S        T
   "abc"       ""
    "bc"      "a"
     "c"     "ba"
      ""    "cab"
We consider the final T as the encrypted S. According to the sender we do not need a separate method to decrypt the message. Your task is to find and implement the method of decryption.

Input Specification

T

A single line with an encrypted message. The message consists of letters from the english ABC and its length is at most 105.

Output Specification

S

The decrypted message.

Sample Input 1

  1. eazegm
download as text file

Sample Output 1

  1. ezgame
download as text file

Sample Input 2

  1. mdyemdyEgeeBgee
download as text file

Sample Output 2

  1. EgyedemBegyedem
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024