Given a string as input, output one or more variants of the string such that:
- No character is in it's original position
- No character is adjacent to a character that it was originally adjacent to
You can assume this will always be possible for the given string, and will only contain single case alphabetical characters (
[A-Z] if you prefer)
Note that duplicates of the same character are not considered unique.
For example, given the input
programming, the output cannot contain an
m at the 7th or 8th character, and cannot contain a
g at the 4th or 11th character (1 indexed)
Take the string
The following would be a valid output:
However the following would be invalid:
fdbcae as in this example
b are still adjacent.
Adjacency also wraps, meaning you could not do
a are still adjacent.
Note these are not the only valid outputs for the given inputs
input -> output:
helowi -> ioewhl mayube -> euabmy stephens -> nhseespt aabcdeffghij -> dbfhjfigaeca
This is code-golf so fewest bytes in each language wins!