[Question]
  [
This is inspired by [Monday Mini-Golf #6: Meeesesessess upp teeexexextext](https://codegolf.stackexchange.com/q/61885/8478)
## Background
[ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions) have difficulty entering text on his usual webpage. Whenever he use digits or letters, the text will be meeesesessessesseesseessedessed up. Your task is to help him type so the normal behavior is achieved.
## The transform
The transform affects runs of alphanumeric (`[0-9A-Za-z]`) characters delimited by any nonalphanumeric characters. In the following example, the first line would be transformed into the second (the other lines show the breakdown of the transform)
```
An12num:
Annn1n12n12nn12nn12nun12nun12numn12num
A
 nn
   n1
     n12
        n12nn12n
                n12nun12nu
                          n12numn12num
```
In particular, any alphanumeric character after the first in a run will be transformed into *the entire run so far except for the first character*. Furthermore, if the character is a letter (as opposed to a digit), the character will be turned into *twice* the run.
Thankfully, backspace will delete last character and also resets the beginning of the run.
## Task
This time your task is not to perform the transformation. Instead, given an input string, you must return an encoded text that, if transformed, will result in the input. The output must be as short as possible, where `\<char>` counted as a single character.
Text is encoded as follows:
```
\                   -> \\
backspace character -> \b
linefeed            -> \n
```
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter.
## Test cases
Each test case is two lines, the first being input, the second output.
```
Heeeeeelp me. It shouldn't be messed up.
Hee \blp\b me\b. It\b sh\bou\bld\bn't be\b me\bss\bed\b up\b.
alert("Hello, world!");
al\ber\bt("He\bll\bo, wo\brl\bd!");
1223234234523456
123456
```
  
[Answer]
# CJam, 207
```
{_,1>{:E1<_0{:I2$,+E=:C+:R1>C'9>)*+:P,E,<{EP#{L0}{PRI)1}?}{PE#L{R8cP,E,-*+}?0}?}g}&}:U;LqS+'a+{_'[,_el^A,s+&,V={+}{s\V!:V{L{:BU_aL?B,,1>Bf{_2$<U_{_W=8>S8c+*+\@>j+}{?;}?}+{,}$0=}j}|\}?}%s'\8cN++'\"\bn"f+er-2<
```
[Try it online](http://cjam.aditsu.net/#code=%7B_%2C1%3E%7B%3AE1%3C_0%7B%3AI2%24%2C%2BE%3D%3AC%2B%3AR1%3EC'9%3E)*%2B%3AP%2CE%2C%3C%7BEP%23%7BL0%7D%7BPRI)1%7D%3F%7D%7BPE%23L%7BR8cP%2CE%2C-*%2B%7D%3F0%7D%3F%7Dg%7D%26%7D%3AU%3BLqS%2B'a%2B%7B_'%5B%2C_el%5EA%2Cs%2B%26%2CV%3D%7B%2B%7D%7Bs%5CV!%3AV%7BL%7B%3ABU_aL%3FB%2C%2C1%3EBf%7B_2%24%3CU_%7B_W%3D8%3ES8c%2B*%2B%5C%40%3Ej%2B%7D%7B%3F%3B%7D%3F%7D%2B%7B%2C%7D%240%3D%7Dj%7D%7C%5C%7D%3F%7D%25s'%5C8cN%2B%2B'%5C%22%5Cbn%22f%2Ber-2%3C&input=Meeesesessessesseesseessedessed%20upp%20teeexexextext)
**Explanation:**
Almost forgot to write this :p
The problem is solved in several steps:
* the text is separated into runs of alphanumeric characters (let's call them words) and runs of non-alphanumeric characters (non-words)
* non-words are printed as they are, and words are fixed
* fixing a word is done recursively (with memoization): split the word into 2 chunks in every possible way (including empty 2nd chunk), try to unmess the first chunk (see below), fix the 2nd chunk and join the results with a space-backspace if needed; take the shortest sub-solution
* unmessing a chunk means finding a minimal string of alphanumeric characters possibly followed by some backspaces (but with no backspaces in the middle) that when messed up, result in the given chunk; it is done with a simple greedy algorithm, going from left to right, building the unmessed string and its messed version in parallel, and determining the next needed character at each step; some chunks can not be unmessed
]