# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), <s>12</s> 11 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) g≠ićs¨.rIθJ [Try it online](https://tio.run/##yy9OTMpM/f8//VHngswj7cWHVugVeZ7b4fX/f0Z@eWJSfmlJSUZmMQA) or [verify some more inputs](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn2ly//0R50LMo@0Fx9aoVdUeW6H1//Dq2t1/mfklycm5ZeWlGRkFnOVpBaXcCVyJSYBUTIIp6SmpWdkZmXn5OblFxQWFZeUlpVXVFZxGRgaGZuYmplbWAIA). Fun **<s>12</s> 11 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)** alternative: g͸1.ø£€.rJ [Try it online](https://tio.run/##yy9OTMpM/f8//XDvoR2Geod3HFr8qGmNXpHX//8Z@eWJSfmlJSUZmcUA) or [verify some more inputs](https://tio.run/##yy9OTMpM/V9TVmmvpPCobZKCkn2ly//0w72HdhjqHd5xaPGjpjV6RV7/df5n5JcnJuWXlpRkZBZzlaQWl3AlciUmAVEyCKekpqVnZGZl5@Tm5RcUFhWXlJaVV1RWcRkYGhmbmJqZW1gCAA). Both version also work for strings with less than 3 characters. The first one could be just `ćs¨.rIθJ` (**8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)**), but then it doesn't work for single-character strings (`"a"` becomes `"aa"`). **Explanation:** <!-- language-all: lang-python --> g # Take the length of the (implicit) input # i.e. "howaboutthis" → 12 # i.e. "a" → 1 ≠i # If this length is not 1: # i.e. 12 → 1 (truthy) # i.e. 1 → 0 (falsey) ć # Extract the head of the (implicit) input # i.e. "howaboutthis" → "owaboutthis" and "h" s # Swap so the list (minus head) is at the top of the stack again ¨ # Remove the last character # i.e. "owaboutthis" → "owaboutthi" .r # Randomly shuffle the characters # i.e. "owaboutthi" → "oohbtwtiua" Iθ # Take the last character of the input # i.e. "howaboutthis" → "s" J # Join the values on the stack together (and output implicitly) # i.e. "h", "oohbtwtiua", "s" → "hoohbtwtiuas" # (Implicit else) # (Output the input as is implicitly) # i.e. "a" ---------- g # Take the length of the (implicit) input # i.e. "howaboutthis" → 12 # i.e. "a" → 1 Í # Subtract 2 # i.e. 12 → 10 # i.e. 1 → -1 ¸ # Wrap it into a list # i.e. 10 → [10] # i.e. -1 → [-1] 1.ø # Surround it with 1s # i.e. [10] → [1,10,1] # i.e. [-1] → [1,-1,1] £ # Split the (implicit) input into parts of that size # i.e. "howaboutthis" and [1,10,1] → ["h","owaboutthi","s"] # i.e. "a" and [1,-1,1] → ["a","",""] € # Map each value to: .r # Randomly shuffle the characters # i.e. ["h","owaboutthi","s"] → ["h","oohbtwtiua","s"] # i.e. ["a","",""] → ["a","",""] J # Join the values in the list together (and output implicitly) # i.e. ["h","oohbtwtiua","s"] → "hoohbtwtiuas" # i.e. ["a","",""] → "a"