{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"给一个字符串S,每次可以将它的第一个字符移到最后面,求这样能得到的字典序最小的字符串。\n如BBAAB,最小的就是AABBB\n"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The input consists of N cases. The first line of the input contains only positive integer N. Then follow the cases. Each case consists of exactly one line containing necklace description. Maximal length of each description is 10000 characters. Each bead is represented by a lower-case character of the english alphabet (a--z), where a \u0026lt; b ... z. \n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n For each case, print exactly one line containing only one integer -- number of the bead which is the first at the worst possible disjoining, i.e.\\ such i, that the string A[i] is lexicographically smallest among all the n possible disjoinings of a necklace. If there are more than one solution, print the one with the lowest i. \n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\nhelloworld\namandamanda\ndontcallmebfu\naaabaaa\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e10\n11\n6\n5\u003c/pre\u003e"}}]}