[Question]
  [
Write a program that takes as its input a string that outputs a string with the following properties.
* If a character in the string is an uppercase letter (ASCII 41-5A), then the character is replaced by a string containing every letter up to and including the original letter in upper case. For example, if the input string is `I`, then the output would be `ABCDEFGHI`.
* Similarly, if a character is a lowercase letter (ASCII 61-7A), then the character is replaced in the same way. `i` would be replaced by `abcdefghi`.
* If a character is a number (ASCII 30-39), then the character is replaced by every number starting from `0` and counting up to the number.
* If the input contains concatenated individual characters, then the replacement sequences are concatenated together.
* All other characters are printed without modification.
*Sample inputs* (separated by blank lines)
```
AbC123
pi=3.14159
Hello, World!
```
*Sample outputs*
```
AabABC010120123
abcdefghijklmnopabcdefghi=0123.0101234010123450123456789
ABCDEFGHabcdeabcdefghijklabcdefghijklabcdefghijklmno, ABCDEFGHIJKLMNOPQRSTUVWabcdefghijklmnoabcdefghijklmnopqrabcdefghijklabcd!
```
This is code golf, fellas. Standard rules apply. Shortest code in bytes wins.
---
To see the leaderboard, click "Show code snippet", scroll to the bottom and click "► Run code snippet". Snippet made by Optimizer.
```
/* Configuration */
var QUESTION_ID = 61940; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 43444; // This should be the user ID of the challenge author.
/* App */
var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;
function answersUrl(index) {
  return "http://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}
function commentUrl(index, answers) {
  return "http://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}
function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}
function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;
var OVERRIDE_REG = /^Override\s*header:\s*/i;
function getAuthorName(a) {
  return a.owner.display_name;
}
function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });
  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);
    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });
  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);
  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });
  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }
}
```
```
body { text-align: left !important}
#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}
#language-list {
  padding: 10px;
  width: 290px;
  float: left;
}
table thead {
  font-weight: bold;
}
table td {
  padding: 5px;
}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">
    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">
    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
```
  
[Answer]
# Pyth, 19 bytes
```
sXzsJ+rBG1jkUTs._MJ
```
Try it online: [Demonstration](http://pyth.herokuapp.com/?test_suite_input=AbC123%0Api%3D3.14159%0AHello%2C%20World%21&code=sXzsJ%2BrBG1jkUTs._MJ&input=AbC123&test_suite=0) or [Test Suite](http://pyth.herokuapp.com/?test_suite_input=AbC123%0Api%3D3.14159%0AHello%2C%20World%21&code=sXzsJ%2BrBG1jkUTs._MJ&input=AbC123&test_suite=1)
### Explanation
```
sXzsJ+rBG1jkUTs._MJ
      rBG1            the list ["abc...xyz", "ABC...XYZ"]
     +    jkUT        appends the string "0123456789"
    J                 save this list of 3 strings in J
   sJ                 join the strings in J
               ._MJ   create all prefixes of the strings in J
              s       and combine them to one list
 XzsJ         s._MJ   translate the input string, chars from sJ
                      get translated to the correct prefix,
                      chars that don't appear in sJ don't get translated
s                     join all resulting translation strings
```
[Answer]
# Python 2.7, ~~100~~ ~~98~~ 96 bytes
```
a=[]
for c in raw_input():d=ord(c);a+=range(max(d&96|1,48),d)*c.isalnum()+[d]
print bytearray(a)
```
[Answer]
# [TeaScript](https://github.com/vihanb/TeaScript/), 24 bytes ~~26~~ ~~28~~
TeaScript is JavaScript for golfing
```
xl(#(i=lN()1)h(ii(l)+1))
```
Pretty short
[Try it online](http://vihanserver.tk/p/TeaScript/?code=xl(%23(i%3DlN()1).h(ii(l)%2B1))&input=AbC123)
### Explanation
```
x.l(#            // Loops through each character of the string
     (i=l.N()1)  // Determines whether a character is alphanumeric
                 // Will return A-Z, a-z or 0-9 depending on result
                 // Assigns to variable i
     .h(         // Get characters up to...
        i.i      // where the character is in "i"
     ) + 1       // Increased by one
)
```
[Answer]
# Ruby, ~~137~~ ~~87~~ ~~82~~ ~~76~~ ~~67~~ 55 bytes
Ungolfed, but you can see the pattern.
```
$><<gets.gsub(/[a-z0-9]/i){[*" 0Aa"[$&.ord/32]..$&]*""}
```
Edit: golfed down to only one regex.
Edit 2: had a lot of extra spaces.
Edit 3: Thanks to manatwork for golfing 12 bytes!
[Answer]
# Haskell, ~~95~~ ~~91~~ ~~86~~ 60 bytes
```
c#(a:o:r)|c<a||c>o=c#r|1<2=[a..c]
c#_=[c]
f=((#"AZaz09")=<<)
```
Usage example: `f "pi=3.14159"` -> `"abcdefghijklmnopabcdefghi=0123.0101234010123450123456789"`
How it works: copy every char c in the input string unless c is in-between any of `A`/`Z`, `a`/`z` or `0`/`9` and if so take the list of `[<first char in pair> ... <c>]`.
Edit: @Zgarb saved many many bytes. Thanks!
[Answer]
# JavaScript (ES6), ~~143~~ 138 bytes
Uses string comparisons to test which characters to use.
```
s=>s.replace(/[A-Z0-9]/gi,c=>(a=btoa`Ó]·ã»óÖq×£Y§¢«²Û¯Ã³`,(c>'Z'?a:a.toUpperCase()).split``.filter(x=>x<=c&(x>'9'|c<'A')).join``))
```
[Online demo.](https://jsfiddle.net/intrepidcoder/1f8LhL4y/) Tested in Firefox and Chrome.
Edit: Saved 5 bytes by replacing `a='0123456789abcdefghijklmnopqrstuvwxyz'` with
```
a=btoa`Ó]·ã»óÖq×£Y§¢«²Û¯Ã³`
```
[Answer]
# Python 2, ~~145~~ ~~140~~ ~~133~~ ~~103~~ 102 Bytes
A not-so-sleek anonymous function using list comprehension. I feel like the logic should be much shorter, I'll try and figure something out.
```
lambda k:''.join([c,`map(chr,range(48+17*(c>'@')+32*(c>'`'),ord(c)+1))`[2::5]][c.isalnum()]for c in k)
```
Should be given a name to be used, i.e. `f=...`
[Answer]
# PHP, 146 bytes
**Golfed**
```
function f($n,&$l){for(;$c=$n[$r],$b=0,$d=ord($c);$r++,$b?:$l.=$c)foreach([58=>48,91=>65,123=>97] as $m=>$i)while($d<$m&&$d>=$i)$b=$l.=chr($i++);}
```
**Revision 1:** put ord ranges directly into foreach. incremented ord range maxes and changed `$d<=$m` to `$d<$m`. using `for` to iterate chars instead of `foreach` and `str_split`. Removed all `{}` by moving code into `for`
[**Ungolfed**](http://sandbox.onlinephpfunctions.com/code/fb88c7fefe02d81935b2359aa3aa1d60f4528df9)
```
function f($input,&$output){
foreach (str_split($input) as $char){
  $ord = ord($char);
  $ords = [57=>48,90=>65,122=>97];
  $b = 0;
  foreach ($ords as $max=>$min){
     while ($ord<=$max&&$ord>=$min){
         $b = $max;
         $output .= chr($min);
         $min++;
     }
  }
  $b ?: $output.=$char;
}
};
$output = NULL;
$input = "pi=3.141592";
f($input,$output);
echo $output;
```
**Explanation:**
split string into array. If ascii value falls into a range (for a-z,A-Z,0-9), then increment a counter from the min of the range to the char's ascii value, appending each value until you reach the char's ascii value.
I passed in  `&$var` so output is done by reference rather than a `return`
[Answer]
## Python, 143 bytes
```
lambda s:''.join(map(chr,sum(map(lambda a,r=range:r(65,a+1)if 64<a<97else r(97,a+1)if 96<a<123else r(48,a+1)if 47<a<58else[a],map(ord,s)),[])))
```
[Try it online](http://ideone.com/6f7sQt)
[Answer]
## Perl 6, 101 bytes
Here is a first pass at it:
```
sub MAIN($_ is copy){
  s:g/<[0..9]>/{(0..$/).join}/;
  s:g/<[a..z]>/{('a'..~$/).join}/;
  s:g/<[A..Z]>/{('A'..~$/).join}/;
  .say
}
```
```
sub MAIN($_ is copy){s:g/<[0..9]>/{(0..$/).join}/;s:g/<[a..z]>/{('a'..~$/).join}/;s:g/<[A..Z]>/{('A'..~$/).join}/;.say}
```
**119**
---
Using `.trans` on `$_`to remove `is copy`.
```
sub MAIN($_){
  .trans(
    /\d/       => {(0..$/).join},
    /<[a..z]>/ => {('a'..~$/).join},
    /<[A..Z]>/ => {('A'..~$/).join}
  ).say
}
```
```
sub MAIN($_){.trans(/\d/=>{(0..$/).join},/<[a..z]>/=>{('a'..~$/).join},/<[A..Z]>/=>{('A'..~$/).join}).say}
```
**106**
---
Act on `@*ARGS` directly instead of defining a `MAIN` sub.  
(otherwise identical to previous example)
```
@*ARGS[0].trans(/\d/=>{(0..$/).join},/<[a..z]>/=>{('a'..~$/).join},/<[A..Z]>/=>{('A'..~$/).join}).say
```
**101**
[Answer]
# Scala, 111 91 bytes
```
val f=(_:String).flatMap(x=>if(x.isDigit)('0'to x)else if(x.isUpper)('A'to x)else('a'to x))
```
[Answer]
# Julia, ~~102~~ ~~98~~ ~~90~~ 84 bytes
```
s->join([(i=Int(c);join(map(Char,(64<c<91?65:96<c<123?97:47<c<58?48:i):i)))for c=s])
```
This creates an unnamed function that accepts a string and returns a string.
Ungolfed:
```
function f(s::AbstractString)
    # For each character in the input, get the codepoint and construct
    # a range of codepoints from the appropriate starting character to
    # the current character, convert these to characters, and join them
    # into a string
    x = [(i = Int(c);
          join(map(Char, (isupper(c) ? 65 :
                          islower(c) ? 97 :
                          isdigit(c) ? 48 : i):i))
         ) for c in s]
    # Join the array of strings into a single string
    return join(x)
end
```
[Answer]
# PowerShell, 155 Bytes
```
($args-split''|%{$b=$_;switch([int][char]$_){{$_-in(65..90)}{[char[]](65..$_)}{$_-in(97..122)}{[char[]](97..$_)}{$_-in(48..57)}{0..$b}default{$b}}})-join''
```
*Technically* a one-liner, and PowerShell is all about those ;-)
Splits the input, pipes that into a `ForEach-Object` loop, switches on the integer value of the cast character, then generates new `char[]` of the appropriate ranges. Note that we have to spend bytes to set a temp variable `$b` because the act of casting the input `$_` in the switch statement means that we can't just keep using `$_` or we'll get funky output.
EDIT - I should point out that this will toss off errors since the first object being fed into `%{...}` is a null object. Since STDERR is [ignored by default](http://meta.codegolf.stackexchange.com/a/4781/42963), this shouldn't be an issue. If it's a problem, change the first bit to be `($args-split''-ne''|...` to eliminate the null object.
[Answer]
# JavaScript (ES6), ~~340~~ ~~258~~ ~~273~~ 271 bytes
```
a=s=>{s=s.split``;Q=x=>x.toUpperCase();A="ABCDEFGHIJKLMNOPQRSTUVWXYZ";D="0123456789";f="";for(i=0;i<s.length;i++){j=s[i];c="to"+(Q(j)==j?"Upper":"Lower")+"Case";j=Q(j);if(q=A.search(j)+1)f+=g=A.slice(0,q)[c]();else if(q=D.search(j)+1)f+=g=D.slice(0,q);else f+=j}return f}
```
[Answer]
## C (269 bytes)
(line break added for clarity)
```
#include<stdio.h>
#define F(x,y,z)if(c>=T[0][x]&&c<=T[1][y]){z}
#define L(x,y)for(i=0;i<x;++i){y}
main(){int c,i,n;char o,*T[]={"0Aa","9Zz"};while((c=getchar())!=EOF)
{F(0,2,L(3,F(i,i,o=T[0][i],n=++c-o;L(n,putchar(o++));break;))else putchar(c);)}}
```
## Ungolfed
```
#include<stdio.h>
int main(void)
{
  int c, i, n;
  char output;
  char *char_table[] = {"0Aa", "9Zz"};
  while ((c = getchar()) != EOF) {
    if (c < '0' || c > 'z') {
      putchar(c);
    } else {
      for (i = 0; i < 3; ++i) {
        if (c >= char_table[0][i] && c <= char_table[1][i]) {
          output = char_table[0][1];
          n = c - output;
          break;
        }
      }
      for (i = 0; i <= n; ++i) {
        putchar(output);
        ++output;
      }
    }
  }
  return(0);
}
```
[Answer]
# [Perl 5](https://www.perl.org/), ~~66~~ ~~61~~ (51 Bytes + 1) 52
Combining regexes with conditional operators worked out nice in this case.  
~~With a join~~ Using map to combine the ranges into an array.
```
say map{(/\d/?0:/[A-Z]/?A:/[a-z]/?a:$_)..$_}split//
```
### Test
```
$ echo "A0C1.a3c_2!" |perl -M5.010 -n count_and_spell_up.pl
A0ABC01.a0123abc_012!
```
**Explanation**
```
say                # print output
  map{             # loop through the array that's at the end of the other mustache. 
                   # outputs an array. 
     (
        /\d/?0            # if $_ is a digit then 0
          :/[A-Z]/?A      # else, if it's an uppercase character then A
             :/[a-z]/?a   # else, if it's a lowercase character then a
               :$_        # else the current character
     )..$_         # generate a sequenced string of characters 
                   # that ends with the magic variable $_ 
                   # ($_ is currently a character from the array)
  }split//     # split the magic variable $_ (currently the input string)
               # to an array of characters
```
[Answer]
# JavaScript (ES7), 125 bytes
There were already two JS answers focusing on encoding the strings, so I decided to go for a more algorithmic approach using `String.fromCharCode()`:
```
x=>x.replace(/[^\W_]/g,z=>(c=z.charCodeAt(),f=c<65?48:c<97?65:97,String.fromCharCode(...[for(i of Array(c-f).keys())i+f])+z))
```
A bonus of using this method is that it takes any amount of char codes, so `join`ing the list is not necessary. This turned out shorter than any other technique, so I'm happy with the result.
[Answer]
# MUMPS, 131 bytes
```
u(l,h) i l'>a,a'>h f j=l:1:a s o=o_$C(j),f=0
    q
t(s) f i=1:1:$L(s) s a=$A(s,i),f=1 d u(48,57),u(65,90),u(97,122) s:f o=o_$C(a)
    q o
```
I did manage to save a good few bytes here thanks to [MUMPS's dynamic scoping](https://softwareengineering.stackexchange.com/questions/297088/how-do-you-safely-refactor-in-a-language-with-dynamic-scope). Here's a roughly-equivalent ungolfed version, which I sure would love to syntax highlight, if only [support for the MUMPS Prettify module were available](https://meta.stackexchange.com/questions/268376/add-the-lang-mumps-module-from-prettify).
```
convert(str) ;
    new asciiCode,flag,i,output
    for i=1:1:$LENGTH(str) do
    . set asciiCode=$ASCII(str,i)
    . set flag=1
    . do helper(48,57)
    . do helper(65,90)
    . do helper(97,122)
    . if 'flag do
    . . set output=output_$CHAR(asciiCode)
    quit
helper(low,high) ;
    if low'>asciiCode,asciiCode'>high do
    . for code=low:1:asciiCode do
    . . set output=output_$CHAR(code)
    . . set flag=0
    quit
```
[Answer]
# Perl 6, ~~78~~ 77 bytes
```
@*ARGS[0].trans(/\d/=>{[~] 0..$/},/<:L>/=>{[~] samecase("a",~$/)..~$/}).say
```
[Answer]
# Mathematica, 102 bytes
```
FromCharacterCode@Flatten[Which[64<#<91,65,96<#<123,97,47<#<58,48,1>0,#]~Range~#&/@ToCharacterCode@#]&
```
Oh well...
[Answer]
# CJam, ~~32~~ 31 bytes
```
q_'[,_el^A,s+26/ff{_@#)<}:s\.e|
```
Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=q_'%5B%2C_el%5EA%2Cs%2B26%2Fff%7B_%40%23)%3C%7D%3As%5C.e%7C&input=pi%3D3.14159).
### How it works
```
q_    e# Push two copies of the user input.
'[,   e# Push the string of all ASCII characters up to Z.
_el   e# Push a copy and convert it to lowercase.
^     e# Perform symmetric difference this keeps only letters.
A,s+  e# Append the string "0123456789".
26/   e# Split the result into chunks of length 26.
ff{   e# For each character from input: For each chunk:
  _@  e#   Copy the chunk and rotate the character on top of it.
  #   e#   Push the index of the character in the string (-1 for not found).
  )<  e#   Increment and keep that many characters from the left of the chunk.
      e#   This pushes "" for index -1.
}
:s    e# Flatten the resulting arrays of strings.
      e# The results will be empty strings iff the character wan't alphanumeric.
\     e# Swap the result with the input string.
.e|   e# Perform vectorized logical OR.
```
[Answer]
# Python 2, ~~135~~ 117 bytes
```
s=''
for c in raw_input():
 b=ord(c);e=b+1
 if c.isalnum():
  b=max(b&96,47)+1
 for i in range(b,e):s+=chr(i)
print s
```
[Answer]
## PHP - 291 bytes
Pass the string to `GET["s"]`.
```
<?php $s=$_GET["s"];$m="array_map";echo implode($m(function($v){$i="in_array";$l="implode";$r="range";global$m;$a=ord($v);if($i($a,$r(48,57)))$v=$l($m("chr",$r(48,$a)));if($i($a,$r(65,90)))$v=$l($m("chr",$r(65,$a)));if($i($a,$r(97,122)))$v=$l($m("chr",$r(97,$a)));return$v;},str_split($s)));
```
[Answer]
# C#, ~~251~~ ~~201~~ ~~184~~ ~~157~~ 154 Bytes
```
using System;class c{static void Main(string[] i){foreach(var c in i[0])for(var x=c>64&c<91?'A':c>96&c<123?'a':c>47&c<58?'0':c;x<=c;)Console.Write(x++);}}
```
edit: Strike! Shorter than PowerShell ;)
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 37 bytes
```
(⊃,/){⎕A∊⍨⌈⍵:⍵…⍨'A'××⍵⋄⍵∊⎕D:'0'…⍵⋄⍵}¨
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/X@NRV7OOvmb1o76pjo86uh71rnjU0/God6sVED9qWAbkqzuqH55@eDqI390CIoGq@qa6WKkbqIMVQIVrD634n/aobcKj3j6gkY961zzq3XJovfGjtolA1cFBzkAyxMMz@H@agrpjkrOhkbE6F5BZkGlrrGdoYmhqCeZ6pObk5OsohOcX5aQoqgMA "APL (Dyalog Extended) – Try It Online")
A train that accepts a string as right argument.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 9 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
žKD₂ô€η˜‡
```
[Try it online](https://tio.run/##yy9OTMpM/f//6D5vl0dNTYe3PGpac2776TmPGhb@/6@kpOSY5GxoZMxVkGlrrGdoYmhqyeWRmpOTr6MQnl@Uk6IIVAEA).
**Explanation:**
```
žK         # Push "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  D        # Duplicate it
   ₂ô      # Split the copy into parts of size 26: ["abc...xyz","ABC...XYZ","012...789"]
     €     # Map over each inner string:
      η    #  Get a list of its prefixes
       ˜   # Flatten this list of lists of strings
           #  ["a","ab","abc",...,"A","AB","ABC",...,"0","01","012",...,"0123456789"]
        ‡  # Transliterate all characters in the (implicit) input-string from 
           # "abc...xyzABC...XYZ012...789" to these prefixes at the same positions
           # (after which the result is output implicitly)
```
]