# [Io], 110 bytes method(x,n,K :=Range 1 to(n)asList;(O :=x map(i,v,x slice(i,i+n)))unique select(x,x sort==K)size==K reduce(*)) [Try it online!][TIO-kd022avw] [Io]: http://iolanguage.org/ [TIO-kd022avw]: https://tio.run/##jYxBCsIwEEX3nmKWGZ1N2q6UnqCC4NpNaVMdSJPapFK8fBxaXIgIrubz/5vHPnWwL@GSehNvvlUzOaqkOdfuakBD9MphHY4c4kGdZJihrwfF9KAZguXGSOadQ8TJ8X0yEIw1TRSR7H6MZVlh4KeRC6NpJ3nYIqZOWVEqTZAR5AQFUoEwjOyidZv3iqS/S4Jf/apag15ytsD5f/AHmV4 "Io – Try It Online" ## Explanation (Ungolfed) ``` method(x,n, // Take the tbd string and the num of uniquified integers K := Range 1 to(n)asList // K = [1..n] O := x map(i,v,x slice(i,i+n)) // O = all n-slices of x O unique // Uniquify these slices select(x, // Filter: (x : current item) x sort==K // sort(x) == [1..n]? ) size // Number of items that satisfy this == K reduce(*) // == factorial(n)? ) ```