Code Golf: Gibberish Echo This is my first code golf challenge, as such I am not entirely certain if it is suitable as a Code Golf challenge, but it's all a learning experience.

The challenge is that in as few characters as possible, using whichever language you prefer, develop a code to complete the following:


Take a value from stdin
Return a value to stdout that contains the same characters as the value at stdin in a different order. Not necessarily random, but following the restrictions set out below.


Here are a few restrictions:


All characters that are contained in the stdin value must appear in stdout value
Characters must appear in stdout the same amount of times they appear in stdin
The order of characters in the output, cannot be identical to the order of characters in input, for more than two consecutive characters. Regardless of the source of the character in the input. That is, the input and output must not have a common substring of length 3 or greater.
Any input where no solution can be found under the previous rule, is considered an invalid input

Examples: aaaa, bbbb
you do not need to test for invalid inputs, assume all inputs are valid.
The length of stdout must be the same as the length of stdin
You may use any method to scramble the initial value, there is nothing off limits here.


Example:


  stdin: Hello There
  
  stout: loTeHle reh


Note: a character in this context can be any valid ASCII character
CJam, 31 27 bytes

l:I{mr[_I]{_,((,\f&gt;3f&lt;}/&amp;}g


Test it here.

Same approach as my Mathematica answer. It keeps generating random permutations of the input, until the substring restriction is satisfied. I think this can be golfed a bit further.