# [C# (Visual C# Interactive Compiler)], 111 bytes <!-- language-all: lang-cs --> s=>{var t=s;do{s=t;t="";for(int i=0;i<s.Length;)t+=s[i]%48*(s[i++]!=(s+0)[i]?1:2*++i/i);}while(t!=s);return t;} [Try it online!][TIO-jqhkekej] [C# (Visual C# Interactive Compiler)]: http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc [TIO-jqhkekej]: https://tio.run/##RU7BbsIwDL33K0y1SQnJWBMKSglht52474A4lC5ApClMjRmTqn57l1Jgvvg9v@dnV@GlCq57P/tqGbB2/sCHtoI9mC6YVfNT1oAm6M9TEwxqNGmq96eaOI/gTKbdMkzW1h/wqCkyEzZu@5yrMYmAse3IkMAyGodvYiHHjLlXR3V7ObovS3BkAtW1xXPtAXXb6SSJ0basjuSaX3Lo244C2hDPefD2stk2CRApJYdcUh6xmE@nkVxxnivFQYn5oMxmouAgM1EMvCh6Wd71oi8OQgl1M9wd4hGRxRLRk4n/lduOUHHU0gTgo3Zo185b8pQ6v4Cmf3hSthzs7/ed7iItK4x0TwadpSltU6q7Pw "C# (Visual C# Interactive Compiler) – Try It Online" HUGE credit to @ASCIIOnly for golfing ~30 ;) At first we were both posting updates simultaneously, but at some point he clearly went to town! -2 thanks to @EmbodimentOfIgnorance! Less golfed code... // s is the input as a string s=>{ // t is another string used // to hold intermediate results var t=s; // the algorithm repeatedly // processes s and saves the // result to t do{ // copy the last result to s // and blank out t s=t; t=""; // iterate over s for(int i=0;i<s.Length;) // append either 1 or 2 times // the current digit to t t+=s[i]%48* // compare the current digit // to the next digit. to prevent // an out-of-bounds exception, // append a 0 to s which either // gets ignored or collapses // to 0 (s[i++]!=(s+0)[i] // if they are different, then // the multiplier is 1 ?1 // if they are the same, then // the multiplier is 2, and we // have to increment i :2*++i/i); } // continue this until the input // and output are the same while(t!=s); return t; }