Company: Amazon_31_jan
Difficulty: medium
Optimal Data Encryption Optimal Data Encryption Problem Description Amazon developers are creating a new data protection module for Amazon Cloud Services. One of its functions is to encrypt incoming data. The encryption method is to select some substring of the data and right rotate that substring by 1 position one time only. The substring is selected in such a way that the resulting encrypted data is alphabetically the smallest data that can be formed using this operation. Here, right rotating any string a by 1 position is to shift every character of string a in the right direction by 1 position and remove the last character and append it to the beginning of string a . For example, if a = "ahssd" , after right rotation by 1 position, string a changes to "dahss" . Given the input input_text as a string, find the encrypted data. Note: A string x is alphabetically smaller than string y , if either x is a prefix of y (and x ≠ y ), or there exists such i (0 ≤ i < min(|x|, |y|)), that x[