Data Encrypftion?
There are different non-efficient ways to store a password. One of the ways is to choose a string S composed of small Latin letters with some length L. Then we make all L-1 one-letter left cyclic shifts of the string, and we take as a password one prefix of the lexicographically first of the obtained strings (including S).
For example let consider the string alabala. The cyclic one-letter left shifts (including the initial string) are:alabala
labalaa
abalaal
balaala
alaalab
laalaba
aalabal
The lexicographically first of them is the string aalabal.
The first letter of this string is in position 6 in the initial string
(the positions in the string are counted from 0).
Write a program that for given string S finds the start position of the smallest lexicographically one-letter left cyclic shift of this string. If the smallest lexicographically left shift appears more than once then the program have to output the smallest initial position.
baabaaOutput:
1alabalaOutput:
6Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.