[Question]
  [
Write the shortest code in the language of your choice to perform run length decoding of the given string.
The string will be supplied as **input on stdin** in the form
```
CNCNCNCNCNCNCNCN
```
where each `C` could be any printable ASCII character and each `N` is a digit `1` to `9` (inclusive).
Sample input:
```
:144,1'1
```
Corresponding output:
```
:4444,'
```
  
[Answer]
# Brainfuck, 34 characters
```
,[>,>++++++[<-------->-]<[<.>-]<,]
```
[Answer]
# [Shakespeare Programming Language](http://esolangs.org/wiki/Shakespeare), 406 bytes
```
.
Ajax,.
Ford,.
Act I:.
Scene I:.
[Enter Ajax and Ford]
Scene II:.
Ford:
Open your mind.Is sky nicer than you?If so, let us return to scene IV.
Ajax:
Open your mind.You is sum you and sum big big big big big big pig and big big big big cat!
Scene III:.
Ford:
Speak thy mind.
Ajax:
You is sum you and pig!Is you as big as zero?If so, let us return to scene II.Let us return to scene III.
Scene IV:.
[Exeunt]
```
Ungolfed version:
```
The Decoding of the Lengths of Veronan Runs - A Drama of PPCG.
Romeo, quite a character.
Juliet, Romeo's lover and multiplicand.
Act I: In which the lengths of runs are decoded.
Scene I: A silent entrance.
[Enter Romeo and Juliet]
Scene II: In which neither Romeo nor Juliet believes the other open-minded.
Juliet:
  Open your mind. Is my mother jollier than thou? If so,
  we must proceed to scene IV.
Romeo:
  Open your mind. Thou art the sum of thyself and the sum of my good aunt and
  the difference between nothing and the quotient of the square of twice the sum
  of thy foul fat-kidneyed goat and thy death and thy evil variable!
Scene III: In which Romeo snaps and brutally insults Juliet.
Juliet:
  Speak thy mind.
Romeo:
  Thou art the sum of thyself and a hog! Art thou as rotten as nothing? If so,
  let us return to scene II. Let us return to scene III.
Scene IV: Finale.
[Exeunt]
```
I'm using [drsam94's Python SPL compiler](https://github.com/drsam94/Spl), which has a few bugs (which is why, for instance, I use `Open your mind` instead of `Open thy mind` in the golfed version).
To run this program, use:
```
$ python splc.py rld.spl > rld.c
$ gcc rld.c -o rld.exe
$ echo -n ":144,1'1" | ./rld
:4444,'
```
## How it works
SPL is an esoteric programming language designed to make programs look like Shakespeare plays. It does this by using characters as variables, and processing is performed by having the characters say things to one another.
```
The Decoding of the Lengths of Veronan Runs - A Drama of PPCG.
```
This is the title of the play; it's ignored by the compiler.
```
Romeo, quite a character.
Juliet, Romeo's lover and multiplicand.
```
Here we're declaring the variables used in the rest of the program. Everything betwen `,` and `.` is ignored by the compiler. In this case, we declare `Romeo`, used to hold the character being decoded, and `Juliet`, used to hold the run length of the character.
```
Act I: In which the lengths of runs are decoded.
```
Here we declare the first and only act in the program. Acts and scenes are like labels; they can be jumped to at any time by using `let us return to scene II` or some variant of that. We only use one act, because it's sufficient for our needs. Again, anything between `:` and `.` is ignored by the compiler.
```
Scene I: A silent entrance.
```
Here we declare the first scene. Scenes are numbered in Roman numerals: the first is `Scene I`, the second `Scene II`, and so on.
```
[Enter Romeo and Juliet]
```
This is a stage direction; in it, we tell the `Romeo` and `Juliet` variables to come onto the "stage". Only two variables can be on the "stage" at once; the stage is used so that the compiler can figure out which variable is addressing which when they speak. Because we have only two variables, Romeo and Juliet will stay onstage for the length of the program.
```
Scene II: In which neither Romeo nor Juliet believes the other open-minded.
```
Another scene declaration. Scene II will be jumped to in order to decode another run-length.
```
Juliet:
```
This form of declaration means that Juliet is going to start speaking. Everything until the next `Romeo:`, stage direction, or scene/act declaration will be a line spoken by Juliet, and thus "me" will refer to Juliet, "you"/"thou" to Romeo, etc.
```
Open your mind.
```
This command stores the ordinal value of single character from STDIN in `Romeo`.
```
Is my mother jollier than thou?
```
In SPL, nouns translate to either 1 or -1 depending on whether they are positive or negative. In this case, `my mother` translates to 1. Adjectives (positive or negative) multiply their noun by 2.
This is a question; in it, Juliet asks if `my mother` (AKA 1) is "jollier" than Romeo. Comparatives either translate to `less than` (if they are negative, like `worse`) or `greater than` (if they are positive, like `jollier`). Therefore, this question boils down to `Is 1 greater than you?`.
The reason we ask this question is to detect the end of the input. Since the value of `EOF` varies by platform, but is usually less than 1, we use this to detect it.
```
If so, we must proceed to scene IV.
```
If the preceding question evaluated to `true`, we jump to scene IV—which is simply the end of the program. In short, if we detect an EOF, we end the program.
```
Romeo:
```
It's now Romeo's line: "me" and "you" refer to Romeo and Juliet, respectively.
```
Open your mind.
```
Again, this statement puts the ordinal value of a single character from STDIN into Juliet, which in this case is the run-length of the character stored in `Romeo`.
```
Thou art the sum of thyself and the sum of my good aunt and the difference 
between nothing and the quotient of the square of twice the sum of thy foul
fat-kidneyed goat and thy death and thy evil variable!
```
This one's too long to go over in great detail, but just trust me in that it translates to `Juliet -= 48`. We do this because Juliet holds the ASCII value of a numeral, and `ord('0') == 48`; in subtracting 48, we translate from the ASCII value of a number to the number itself.
```
Scene III: In which Romeo snaps and brutally insults Juliet.
```
Another scene declaration. This one is for the loop in which we repeatedly print the character value of `Romeo`, `Juliet` times.
```
Juliet:
  Speak thy mind.
```
This statement causes Romeo to print his value as a character; that is, whatever character value was previously stored in Romeo is now output.
```
Romeo:
  Thou art the sum of thyself and a hog!
```
A hog is a negative noun, so `a hog` translates to -1; therefore, this statement evaluates to `Juliet -= 1`.
```
Art thou as rotten as nothing?
```
Romeo here asks if Juliet is "as rotten as", or equal to, 0.
```
If so, let us return to scene II.
```
If Juliet's value is 0, we loop back to scene II to decode another character's run-length.
```
Let us return to scene III.
```
Else, we loop back to scene III to output Romeo's character again.
```
Scene IV: Finale.
[Exeunt]
```
This final scene declaration is just a marker for the end of the program. The `[Exeunt]` stage direction is necessary to get the compiler to actually generate the final scene.
[Answer]
### GolfScript, 10 characters
```
2/{1/~~*}/
```
[Answer]
# perl, 27 characters
```
print<>=~s/(.)(.)/$1x$2/ger
```
[Answer]
## Python 3, 52
Python 3 allows me to merge the approaches of my two python2 solutions.
```
s=input()
t=''
while s:a,b,*s=s;t+=a*int(b)
print(t)
```
[Answer]
## R 67
```
x=strsplit(readline(),"")[[1]];cat(rep(x[c(T,F)],x[c(F,T)]),sep="")
```
[Answer]
# Malbolge Unshackled (20-trit rotation variant), 4,494e6 bytes
Size of this answer exceeds maximum postable program size (eh), so the code is [located in my GitHub repository](https://github.com/KrzysztofSzewczyk/codegolf-submissions/raw/master/12902.mb).
## How to run this?
This might be a tricky part, because naive Haskell interpreter will take ages upon ages to run this. TIO has decent Malbogle Unshackled interpreter, but sadly I won't be able to use it (limitations).
The best one I could find is the fixed 20-trit rotation width variant, that performs very well, **decompressing 360 bytes per hour**.
To make the interpreter a bit faster, I've removed all the checks from Matthias Lutter's Malbolge Unshackled interpreter.
My modified version can run around 6,3% faster.
```
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char* translation = "5z]&gqtyfr$(we4{WP)H-Zn,[%\\3dL+Q;>U!pJS72Fh"
        "OA1CB6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G\"i@";
typedef struct Word {
    unsigned int area;
    unsigned int high;
    unsigned int low;
} Word;
void word2string(Word w, char* s, int min_length) {
    if (!s) return;
    if (min_length < 1) min_length = 1;
    if (min_length > 20) min_length = 20;
    s[0] = (w.area%3) + '0';
    s[1] = 't';
    char tmp[20];
    int i;
    for (i=0;i<10;i++) {
        tmp[19-i] = (w.low % 3) + '0';
        w.low /= 3;
    }
    for (i=0;i<10;i++) {
        tmp[9-i] = (w.high % 3) + '0';
        w.high /= 3;
    }
    i = 0;
    while (tmp[i] == s[0] && i < 20 - min_length) i++;
    int j = 2;
    while (i < 20) {
        s[j] = tmp[i];
        i++;
        j++;
    }
    s[j] = 0;
}
unsigned int crazy_low(unsigned int a, unsigned int d){
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    int position = 0;
    unsigned int output = 0;
    while (position < 10){
        unsigned int i = a%3;
        unsigned int j = d%3;
        unsigned int out = crz[i+3*j];
        unsigned int multiple = 1;
        int k;
        for (k=0;k<position;k++)
            multiple *= 3;
        output += multiple*out;
        a /= 3;
        d /= 3;
        position++;
    }
    return output;
}
Word zero() {
    Word result = {0, 0, 0};
    return result;
}
Word increment(Word d) {
    d.low++;
    if (d.low >= 59049) {
        d.low = 0;
        d.high++;
        if (d.high >= 59049) {
            fprintf(stderr,"error: overflow\n");
            exit(1);
        }
    }
    return d;
}
Word decrement(Word d) {
    if (d.low == 0) {
        d.low = 59048;
        d.high--;
    }else{
        d.low--;
    }
    return d;
}
Word crazy(Word a, Word d){
    Word output;
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    output.area = crz[a.area+3*d.area];
    output.high = crazy_low(a.high, d.high);
    output.low = crazy_low(a.low, d.low);
    return output;
}
Word rotate_r(Word d){
    unsigned int carry_h = d.high%3;
    unsigned int carry_l = d.low%3;
    d.high = 19683 * carry_l + d.high / 3;
    d.low = 19683 * carry_h + d.low / 3;
    return d;
}
// last_initialized: if set, use to fill newly generated memory with preinitial values...
Word* ptr_to(Word** mem[], Word d, unsigned int last_initialized) {
    if ((mem[d.area])[d.high]) {
        return &(((mem[d.area])[d.high])[d.low]);
    }
    (mem[d.area])[d.high] = (Word*)malloc(59049 * sizeof(Word));
    if (!(mem[d.area])[d.high]) {
        fprintf(stderr,"error: out of memory.\n");
        exit(1);
    }
    if (last_initialized) {
        Word repitition[6];
        repitition[(last_initialized-1) % 6] =
                ((mem[0])[(last_initialized-1) / 59049])
                    [(last_initialized-1) % 59049];
        repitition[(last_initialized) % 6] =
                ((mem[0])[last_initialized / 59049])
                    [last_initialized % 59049];
        unsigned int i;
        for (i=0;i<6;i++) {
            repitition[(last_initialized+1+i) % 6] =
                    crazy(repitition[(last_initialized+i) % 6],
                        repitition[(last_initialized-1+i) % 6]);
        }
        unsigned int offset = (59049*d.high) % 6;
        i = 0;
        while (1){
            ((mem[d.area])[d.high])[i] = repitition[(i+offset)%6];
            if (i == 59048) {
                break;
            }
            i++;
        }
    }
    return &(((mem[d.area])[d.high])[d.low]);
}
unsigned int get_instruction(Word** mem[], Word c,
        unsigned int last_initialized,
        int ignore_invalid) {
    Word* instr = ptr_to(mem, c, last_initialized);
    unsigned int instruction = instr->low;
    instruction = (instruction+c.low + 59049 * c.high
            + (c.area==1?52:(c.area==2?10:0)))%94;
    return instruction;
}
int main(int argc, char* argv[]) {
    Word** memory[3];
    int i,j;
    for (i=0; i<3; i++) {
        memory[i] = (Word**)malloc(59049 * sizeof(Word*));
        if (!memory) {
            fprintf(stderr,"not enough memory.\n");
            return 1;
        }
        for (j=0; j<59049; j++) {
            (memory[i])[j] = 0;
        }
    }
    Word a, c, d;
    unsigned int result;
    FILE* file;
    if (argc < 2) {
        // read program code from STDIN
        file = stdin;
    }else{
        file = fopen(argv[1],"rb");
    }
    if (file == NULL) {
        fprintf(stderr, "File not found: %s\n",argv[1]);
        return 1;
    }
    a = zero();
    c = zero();
    d = zero();
    result = 0;
    while (!feof(file)){
        unsigned int instr;
        Word* cell = ptr_to(memory, d, 0);
        (*cell) = zero();
        result = fread(&cell->low,1,1,file);
        if (result > 1)
            return 1;
        if (result == 0 || cell->low == 0x1a || cell->low == 0x04)
            break;
        instr = (cell->low + d.low + 59049*d.high)%94;
        if (cell->low == ' ' || cell->low == '\t' || cell->low == '\r'
                || cell->low == '\n');
        else if (cell->low >= 33 && cell->low < 127 &&
                (instr == 4 || instr == 5 || instr == 23 || instr == 39
                    || instr == 40 || instr == 62 || instr == 68
                    || instr == 81)) {
            d = increment(d);
        }
    }
    if (file != stdin) {
        fclose(file);
    }
    unsigned int last_initialized = 0;
    while (1){
        *ptr_to(memory, d, 0) = crazy(*ptr_to(memory, decrement(d), 0),
                *ptr_to(memory, decrement(decrement(d)), 0));
        last_initialized = d.low + 59049*d.high;
        if (d.low == 59048) {
            break;
        }
        d = increment(d);
    }
    d = zero();
    unsigned int step = 0;
    while (1) {
        unsigned int instruction = get_instruction(memory, c,
                last_initialized, 0);
        step++;
        switch (instruction){
            case 4:
                c = *ptr_to(memory,d,last_initialized);
                break;
            case 5:
                if (!a.area) {
                    printf("%c",(char)(a.low + 59049*a.high));
                }else if (a.area == 2 && a.low == 59047
                        && a.high == 59048) {
                    printf("\n");
                }
                break;
            case 23:
                a = zero();
                a.low = getchar();
                if (a.low == EOF) {
                    a.low = 59048;
                    a.high = 59048;
                    a.area = 2;
                }else if (a.low == '\n'){
                    a.low = 59047;
                    a.high = 59048;
                    a.area = 2;
                }
                break;
            case 39:
                a = (*ptr_to(memory,d,last_initialized)
                        = rotate_r(*ptr_to(memory,d,last_initialized)));
                break;
            case 40:
                d = *ptr_to(memory,d,last_initialized);
                break;
            case 62:
                a = (*ptr_to(memory,d,last_initialized)
                        = crazy(a, *ptr_to(memory,d,last_initialized)));
                break;
            case 81:
                return 0;
            case 68:
            default:
                break;
        }
        Word* mem_c = ptr_to(memory, c, last_initialized);
        mem_c->low = translation[mem_c->low - 33];
        c = increment(c);
        d = increment(d);
    }
    return 0;
}
```
## It's working!
[![It's working](https://i.stack.imgur.com/5KgEv.png)](https://i.stack.imgur.com/5KgEv.png)
[Answer]
## APL (22)
```
,/{⍺/⍨⍎⍵}/↑T⊂⍨~⎕D∊⍨T←⍞
```
Explanation:
* `T←⍞`: store input in `T`
* `T⊂⍨~⎕D∊⍨T`: split `T` on those characters that aren't digits
* `↑`: turn it into a `2`-by-`N/2` matrix
* `{⍺/⍨⍎⍵}/`: on each row of the matrix (`/`), replicate (`/`) the first character (`⍺`) by the eval (`⍎`) of the second character (`⍵`)
* `,/`: concatenate the output of each row
[Answer]
# Ruby, 30 bytes
```
gsub!(/(.)(.)/){$1*$2.to_i}
```
27 bytes code + 3 bytes to run it with the `-p` flag:
```
$ ruby -p rld.rb <<< ":144,1'1"
:4444,'
```
[Answer]
**8086 assembly, 106 98 characters**
```
l:
mov ah,8
int 21h
mov bl,al
int 21h
sub al,48
mov cl,al
xor ch,ch
mov al,bl
mov ah,14
p:
int 10h
loop p
jmp l
```
If the numbers were before the characters in the input stream, two lines (18 characters) could be shaved off of this.
[Answer]
## GNU SED, 122 + 2 (-r)
```
#n
s/.*/\n&\a987654321\v\v\v\v\v\v\v\v\v/
:a
s/\n(.)(.)(.*\a.*\2.{9}(.*))/\1\n\4\3/
tb
bc
:b
s/(.)\n\v/\1\1\n/
tb
ba
:c
P
```
Needs to be run with the `-r` flag  
May be reduced to 110 + 2 by replacing `\v` with the unprintable `0x0B` and `\a` with `0x07`
[Answer]
## C, 65 chars
Gets the input as a parameter.
```
main(p,v)char*p,**v;{
    for(p=v[1];*p;--p[1]<49?p+=2:0)putchar(*p);
}
```
[Answer]
## Perl, ~~19~~ 18 characters
```
perl -pe 's/(.)(.)/$1x$2/ge'
```
The rules for counting switches on the command-line are [here](http://meta.codegolf.stackexchange.com/a/274/199).
[Answer]
# Forth, 45 characters
```
BEGIN KEY KEY 48 - 0 DO DUP EMIT LOOP 0 UNTIL
```
Tested with pforth on OS X.
[Answer]
# Python, ~~63~~ 62 characters
```
print''.join([c*int(n)for c,n in zip(*[iter(raw_input())]*2)])
```
[Answer]
## Windows PowerShell, 55 chars
```
-join((read-host)-split'(..)'|%{(""+$_[0])*(""+$_[1])})
```
I get the feeling that this can be golfed down more, specifically with the casts from char to string and int, but I don't have the time to keep working on it right now.
[Answer]
# C, 68 characters
@ugoren's answer in C is slightly shorter, but this answer complies with the requirement that "the string will be supplied as input on **stdin**."
```
n;main(c){for(;;){c=getchar(),n=getchar()-48;while(n--)putchar(c);}}
```
[Answer]
# Haskell, ~~58~~ 56 characters
```
f[]=[]
f(x:y:s)=replicate(read[y])x++f s
main=interact$f
```
My first real attempt at golfing anything, so there's probably some improvement to be made here.
[Answer]
# [Japt](https://github.com/ETHproductions/japt) [`-P`](https://codegolf.meta.stackexchange.com/a/14339/), 8 bytes
Input as an array of characters, output as a string.
```
ò crÈpY°
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&flags=LVA&code=8iBjcshwWbA&input=WyI6IiwiMSIsIjQiLCI0IiwiLCIsIjEiLCInIiwiMSJd)
```
ò crÈpYn     :Implicit input of character array
ò            :Groups of 2
   r         :Reduce each pair
    È        :By passing them through the following function as [X,Y]
     p       :  Repeat X
      Yn     :    Y, converted to an integer, times
             :Implicitly join and output
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~6~~ 5 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
2ι`ÅΓ
```
-1 byte thanks to *@Grimy*.
Outputs as a list of characters.
[Try it online.](https://tio.run/##yy9OTMpM/f/f6NzOhMOt5yb//29laGKiY6huDAA)
**Old 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer without run-length decode builtin:**
```
2ôε`×?
```
[Try it online.](https://tio.run/##yy9OTMpM/f/f6PCWc1sTDk@3///fytDERMdQ3fi/rm5evm5OYlUlAA)
**Explanation:**
```
2ι      # Uninterleave the (implicit) input-string in two parts
        #  i.e. ":144,1'3" → [":4,'","1413"]
  `     # Push both separated to the stack
   ÅΓ   # Run-length decode
        #  i.e. ":4,'" and "1413" → [":","4","4","4","4",",","'","'","'"]
        # (after which the result is output implicitly)
2ô      # Split the (implicit) input-string into parts of size 2
        #  i.e. ":144,1'3" → [":1","44",",1","'3"]
  ε     # Loop over each of these pairs:
   `    #  Push both characters separated to the stack
    ×   #  Repeat the first character the digit amount of times as string
        #   i.e. "'" and "3" → "'''"
     ?  #  And print it without trailing newline
```
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `J`, 4 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
d^N×
```
[Try it online!](https://Not-Thonnu.github.io/run#P2hlYWRlcj0mY29kZT1kJTVFTiVDMyU5NyZmb290ZXI9JmlucHV0PSUzQTE0NCUyQzEnMSZmbGFncz1K)
#### Explanation
```
d^N×  # Implicit input      ->  ":144,1'1"
d     # Cast to characters  ->  [":","1","4","4",",","1","'","1"]
 ^    # Uninterleave        ->  [":","4",",","'"]  ["1","4","1","1"]
  N   # Cast to integer     ->  [":","4",",","'"]  [1,4,1,1]
   ×  # Multiply together   ->  [":","4444",",","'"]
      # Implicit output     ->  :4444,'
```
[Answer]
**Python, 78 72 66 char**
```
d=raw_input()
print"".join([x*int(d[i+1])for i,x in enumerate(d)if~i&1])
```
```
s=raw_input()
print"".join(i*int(j)for i,j in zip(s[::2],s[1::2]))
```
[Answer]
### GolfScript (10 chars)
```
2/{)15&*}/
```
[Answer]
# J - 24
```
;@(_2(<@#~".)/\])@1!:1 3
```
The point of this submission is to use the infix adverb.
[Answer]
## Befunge, 49 chars
```
>~:25*-      v
$>\1-:v:-*68~_@
$^ ,:\_v
^      <
```
[Answer]
# K, 35
```
{,/(#).'|:'"*I"$/:(2*!-_-(#x)%2)_x}
```
[Answer]
## Python 2, 58
This is inspired by Darren Stone's python solution -- iterator abuse!
```
x=iter(raw_input())
print''.join(a*int(next(x))for a in x)
```
This is my original solution (60 chars)
```
s=raw_input()
t=''
while s:t+=s[0]*int(s[1]);s=s[2:]
print t
```
A different approach is 3 chars longer:
```
f=lambda a,b,*x:a*int(b)+(x and f(*x)or'')
print f(raw_input())
```
[Answer]
Java: 285 charas
```
import java.util.Scanner;public class A{public static void main(String args[]){Scanner s = new Scanner(System.in);while(s.hasNext()){String t=s.next();for(int i=0;i<t.length();i++) {for(int j=0; j<(Byte.valueOf(t.substring(i+1,i+2)));j++){System.out.print(t.substring(i,i+1));}i++;}}}}
```
[Answer]
## Befunge-98, 22 chars
```
>#@~~"0"-v
^#:\,:\-1<_
```
[Answer]
## Whitespace, 135
```
LSSSLSSSSLSLSTLTSTTTSLSSSSTSSSSLTSSTLTTTTLSSSSLSLSTLTSTTTSSSTTSSSSLTSSTLSSSSLSLSLTSTLSSSTLTSSTSTSSTLTLSSLSLSSLLSSTLSLLSLLLSLSLLSSTTLLLL
```
(Replace S,T,L with Space,Tab,Linefeed characters.)
Try it online [[here]](http://ideone.com/NV9xnx).
Explanation:
```
"assembly"      whitespace                                      stack
----------      ----------                                      -----
s:              LSS SL      ;input loop                         []
    push 0      SS SSL                                          [0]
    dup         SLS                                             [0,0]
    getc        TLTS        ;input & store char c               [0]
    rcl         TTT         ;recall c                           [c]
    dup         SLS                                             [c,c]
    push 16     SS STSSSSL                                      [c,c,16]
    sub         TSST                                            [c,c-16]
    jlt  tt     LTT TTL     ;exit if ord(c) < 16                [c]       
    push 0      SS SSL                                          [c,0]
    dup         SLS                                             [c,0,0]
    getc        TLTS        ;input & store char n               [c,0]
    rcl         TTT         ;recall n                           [c,n]
    push 48     SS STTSSSSL ;convert n to m = ord(n)-ord('0')   [c,n,48]
    sub         TSST                                            [c,m]
ss:             LSS SSL     ;inner loop outputs c, m times      [c,m]
    dup         SLS                                             [c,m,m]
    jeq  t      LTS TL      ;if m==0, stop outputting this c    [c,m]
    push 1      SS STL      ;otherwise decr m                   [c,m,1]
    sub         TSST                                            [c,m-1]
    copy 1      STS STL     ;copy c to tos                      [c,m-1,c]
    putc        TLSS        ;output this c                      [c,m-1]
    jmp  ss     LSL SSL     ;loop back to output this c again   [c,m-1]
t:              LSS TL                                          [c,m]
    pop         SLL                                             [c]
    pop         SLL                                             []
    jmp  s      LSL SL      ;loop back to get the next c,n      []
tt:             LSS TTL                                         [c]
    end         LLL         ;exit
```
]