SPOJ BEADS

From Algorithmist
Jump to navigation Jump to search

11391 - EASY MATH[edit]

Summary[edit]

Find the lexicographically smallest cyclic string of length l.

Explanation[edit]

Gotchas[edit]

Notes[edit]

Implementations[edit]

Concatenate the string with itself.
form substring of length l from 0th position to l-1 th position. print the least.

Optimizations[edit]

Input[edit]

4
helloworld
amandamanda
dontcallmebfu
aaabaaa

Output[edit]

10
11
6
5

References[edit]

http://www.spoj.pl/problems/BEADS/

StringAdhoc