Cyclic Permutations

Original Python by Miles Gould, converted to PHP, modified and improved by Matthew Somerville

Enter a cycle structure here (e.g. “123 123” or “(1 2) (1 3)”)