defgetMinDenote(s:str) -> str: lens = len(s) word = list(s) + list(s) i,j = 0, 1 while i < lens and j < lens: k = 0 while k < lens and word[i + k] == word[j + k]: k += 1 if k == lens: break if word[i + k] > word[j + k]: i += (k + 1) if i == j: i += 1 else: j += (k + 1) if i == j: j += 1 mind = min(i,j) return''.join(word[mind:mind+lens])