[Question]
  [
# All Aboard the ASCII Train!
```
    o O O   ___     ___     ___     ___     ___     ___     ___     ___     ___  
   o       | C |   | O |   | D |   | E |   |   |   | G |   | O |   | L |   | F | 
  TS__[O]  |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___| 
 {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
You best be prepared to ride the train, because you're about to build the train you'll be riding on. Given a string `s`, output a fully formed train as depicted above. The first thing output is always the engine that'll be tugging your string along, as depicted alone below:
```
    o O O 
   o      
  TS__[O] 
 {======| 
./o--000' 
```
Following the locomotive are rail-cars containing each character of your precious cargo. To save confusion when unloading, your company has tasked you with labeling the outside of these cars. The cars in question will always look like this:
```
   ___ 
  | # |
  |___|
_|"""""|
"`-0-0-'
```
Where the `#` is representative of the character that is inside the "cargo" hold. Chaining the engine to each car is also part of your job, as you've been tasked with overseeing the fluidity and success of this entire shipment. So, once you've labeled all the cars and got the engine on the tracks, you must ensure that the train is assembled and ready to roll.
# Rules
* The only input your program should take is a single string.
* The engine must always be output, even if your shipment is empty.
* Each car can only hold one character, don't push your luck you may damage the goods.
* You need only support the following printable ASCII characters:
`_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`  
If you end up doing more, that's fine too, but this is the bare minimum.
* 1-2 trailing spaces are acceptable, as is a single trailing newline.
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")[ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'"), shortest byte-count wins.
  
[Answer]
# JavaScript (ES6), ~~149~~ 144 bytes
```
s=>`    o O Oa   ___  
   o     a  | $& | 
  TS__[O]a  |___| 
 {======|a_|"""""|
./o--000'a"\`-0-0-'`.replace(/a(.*)/g,(_,c)=>s.replace(/./g,c))
```
I don't think the engine itself can be compressed, but perhaps it's possible.
### Test snippet
```
let f =
s=>`    o O Oa   ___  
   o     a  | $& | 
  TS__[O]a  |___| 
 {======|a_|"""""|
./o--000'a"\`-0-0-'`.replace(/a(.*)/g,(_,c)=>s.replace(/./g,c))
O.innerHTML = f("CODE GOLF")
```
```
<input value="CODE GOLF" oninput="O.innerHTML=f(this.value.replace(/\n/g,'&lt;br&gt;'))"><br>
<pre id=O></pre>
```
[Answer]
# Befunge, ~~276~~ 270 bytes
```
p1p~:7>7+#:`#~_$:v
>#p0p10:p00:+1g00_v#:
v"!!```!!!"v>0p01g\-0g1+53p  
v"!}!#!}!!"v0 p115<
v"!}```}!!"v^:-1<
v"}#####}`">00g:|
>"(.1.1.a#"^+<v1<
v"P!P!p!!! "v5>g00p
v"!!!!!p!!!"v6
v"^P\``TU!!"vp
v"}>>>>>>|!"v+
>"(111..p0/"v6
v-1:g110">>"<g
>:11p!#v_p011^
#-:#1_@>$$$$>,#
```
[Try it online!](http://befunge.tryitonline.net/#code=cDFwfjo3PjcrIzpgI35fJDp2Cj4jcDBwMTA6cDAwOisxZzAwX3YjOgp2IiEhYGBgISEhInY-MHAwMWdcLTBnMSs1M3AgIAp2IiF9ISMhfSEhInYwIHAxMTU8CnYiIX1gYGB9ISEidl46LTE8CnYifSMjIyMjfWAiPjAwZzp8Cj4iKC4xLjEuYSMiXis8djE8CnYiUCFQIXAhISEgInY1PmcwMHAKdiIhISEhIXAhISEidjYKdiJeUFxgYFRVISEidnAKdiJ9Pj4-Pj4-fCEidisKPiIoMTExLi5wMC8idjYKdi0xOmcxMTAiPj4iPGcKPjoxMXAhI3ZfcDAxMV4KIy06IzFfQD4kJCQkPiwj&input=Q09ERSBHT0xG)
**Explanation**
The car and engine are encoded as two sets of five strings on lines 3 to 12. The character values are off by 1 so as to avoid having to deal with the double quotes which can't be used in a Befunge string.
The code works by building up the full set of characters needed to render the train on the stack. For each line of output, an appropriate car string is first added to the stack, repeated as many times as necessary for the cargo, and then one copy of the appropriate engine string.
After each line has been constructed, a pair of the down arrows to left of the strings is replaced with a right arrow, so the next iteration of the loop follows a different path through the code, using a different pair of strings for the car and engine.
Once all the data has been built up on the stack, there's a final rendering loop which writes out the characters, subtracting 1 each time to account for the initial encoding.
~~As a bonus, the source is designed in the shape of a [gun turret](http://vignette1.wikia.nocookie.net/battlefront/images/e/e9/Hoth_Defence_Turret.JPG), in case the train comes under attack.~~ Golfers destroyed my gun turret.
[Answer]
# PHP, ~~218 211 204 187~~ 183 bytes
```
    o O O<?for(;$y<5;print"\n".["   o     ","  TS__[O]"," {======|","./o--000'"][+$y++])for($p=0;$c=a&$argn[$p++];)echo["   ___  ","  | $c | ","  |___| ",'_|"""""|',"\"`-0-0-'"][+$y];
```
Takes input from STDIN; run with `-nR`.
Compressing the engine or wagon would require more code to decompress than it saves on storage.  
I see no more potential here.
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~101~~ 99 bytes
Naive first attempt.
```
"    o O O   o"ð7×"TS__[O] {======|./o--000'"J5ä¹v… _ €ÐJy“ | ÿ |   |___| _|"""""|"`-0-0-'“«5ä})øJ»
```
[Try it online!](http://05ab1e.tryitonline.net/#code=IiAgICBvIE8gTyAgIG8iw7A3w5ciVFNfX1tPXSB7PT09PT09fC4vby0tMDAwJyJKNcOkwrl24oCmIF8g4oKsw5BKeeKAnCB8IMO_IHwgICB8X19ffCBffCIiIiIifCJgLTAtMC0n4oCcwqs1w6R9KcO4SsK7&input=MDVBQjFF)
[Answer]
## Python 2, 176 bytes
```
lambda i:'\n'.join(map(''.join,zip(*[["    o O O","   o     ","  TS__[O]"," {======|","./o--000'"]]+[["   ___  ",'  | '+x+' | ',"  |___| ",'_|"""""|',"\"`-0-0-'"]for x in i])))
```
Example:
```
print f('Python')
```
gives
```
    o O O   ___     ___     ___     ___     ___     ___  
   o       | P |   | y |   | t |   | h |   | o |   | n | 
  TS__[O]  |___|   |___|   |___|   |___|   |___|   |___| 
 {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
[Answer]
## Powershell, ~~167~~ 166 Bytes
```
$l=($a=$args[0]).Length;"    o O O"+"   ___  "*$l;"   o     "+($a[0..$l]|%{"  | $_ |"});"  TS__[O]"+"  |___| "*$l;" {======|"+'_|"""""|'*$l;"./o--000'"+'"`-0-0-'''*$l
```
Example:
```
.\train.ps1 "PowerShell!"
    o O O   ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___  
   o       | P |   | o |   | w |   | e |   | r |   | S |   | h |   | e |   | l |   | l |   | ! |
  TS__[O]  |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___| 
 {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
Possibly Invalid! If run with no args at all it will try and print one empty string, and look like:
```
    o O O
   o       |  |
  TS__[O]
 {======|
./o--000'
```
If run with an empty input string it will return correctly however:
```
.\train.ps1 ""
    o O O
   o     
  TS__[O]
 {======|
./o--000'
```
(kinda) Ungolfed:
```
$l=($a=$args[0]).Length
"    o O O"+"   ___  "*$l
"   o     "+($a[0..$l]|%{"  | $_ |"})
"  TS__[O]"+"  |___| "*$l
" {======|"+'_|"""""|'*$l
"./o--000'"+'"`-0-0-'''*$l
```
shortest compression in Powershell is going to be `+'c'*x` where c is the char and x is the number of repetitions, and that's only for trailing or leading repetitions, any center-string repetitions will require an extra `+` and an extra `"` - so there's no point in this where I can see compression saving any space, and the only repeated char set is `___` which is only 3 chars.
Explanation:
`$l=($a=$args[0]).Length` Take the first arg, put it into $a, then take the length of $a and put it into $l, these are the only variables you need.
`" o O O"+" ___ "*$l` most of the other bits follow this format of the left-part and then the right part times the number of required chars.
`" o "+([char[]]$a|%{" | $_ |"})` loop (`|%{}`) through $a as a char array, so `foreach (char $_ in $a)` for a non-pipeline version, then put the char into the text.
this is an extremely simple approach, but because I can't find a good way to compress the strings past this it seems like the most useful.
saved 1 Byte thanks to briantist! and here I was thinking this wouldn't get any shorter..
[Answer]
# Java, 361 bytes
```
class C {static void main(String[]v){Scanner q = new Scanner(System.in);String i = q.nextLine();String[] t = {"    o O O   ", "   o       ", "  TS__[O]  ", " {======|", "./o--000'",};for (char c: i.toCharArray()) {t[0]+="___     ";t[1]+="| # |   ".replace('#',c);t[2]+="|___|   ";t[3]+="_|\"\"\"\"\"|";t[4]+="\"`-0-0-'";}for(String p:t) System.out.println(p);}}
```
```
class C {
    static void main(String[]v)  {
        Scanner q = new Scanner(System.in);
        String i = q.nextLine();
        String[] t = {
                "    o O O   ",
                "   o       ",
                "  TS__[O]  ",
                " {======|",
                "./o--000'",
        };
        for (char c: i.toCharArray()) {
            t[0]+="___     ";
            t[1]+="| # |   ".replace('#',c);
            t[2]+="|___|   ";
            t[3]+="_|\"\"\"\"\"|";
            t[4]+="\"`-0-0-'";
        }
        for(String p:t)
            System.out.println(p);
    }
}
```
Example
```
java
    o O O   ___     ___     ___     ___     
   o       | j |   | a |   | v |   | a |   
  TS__[O]  |___|   |___|   |___|   |___|   
 {======|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
[Answer]
## Perl, 137 bytes
132 bytes of code + 5 bytes for`-pF` flags.
`ascii_train.pl`:
```
#!/usr/bin/perl -apF
s/./  | $& | /g;$_="    o O O!   ___  
   o     $_
  TS__[0]!  |___| 
 {======|!".'_|"""""|'."
./o--000'!\"`-0-0-'";s/!(.*)/$1x@F/ge
```
*Note that I added `-a` flag in the code, but it's only because old versions of Perl require `-a` when `-F` is used.* 
To run it: 
```
echo -n "code-golf" | perl ascii_train.pl
```
The input must be supplied without a final newline (with `echo -n` for instance). 
**Explanations:**  
From what I've seen, it's roughly the same idea as ETHProduction's JavaScript answer.  
There isn't a lot going on: sadly the patterns are a bit to short to make `x` operator worth being used.  
First, `s/./ | $& | /g` surrounds each character of the input with `|` (and spaces) to form the second level of the train.  
Then inside that long string, everything between a `!` and a newline is a pattern we wish to repeat to construct the cars. That repetition is done thanks to the regex `s/!(.*)/$1x@F/ge`. (I used `!` because the input can't contain it).
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGL), ~~57~~ 56 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md)
```
Τ¡ā↓mΛC┌─⁵℮Ƨ⅛□→(š;∞⅟¹°⅔Ζ‽ζ÷⁴‘9n,{"s=Ο!NθæιžGš‼t╬¼Xg`‘8n┼
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUwM0E0JUExJXUwMTAxJXUyMTkzbSV1MDM5QkMldTI1MEMldTI1MDAldTIwNzUldTIxMkUldTAxQTcldTIxNUIldTI1QTEldTIxOTIlMjgldTAxNjElM0IldTIyMUUldTIxNUYlQjklQjAldTIxNTQldTAzOTYldTIwM0QldTAzQjYlRjcldTIwNzQldTIwMTg5biUyQyU3QiUyMnMlM0QldTAzOUYlMjFOJXUwM0I4JUU2JXUwM0I5JXUwMTdFRyV1MDE2MSV1MjAzQ3QldTI1NkMlQkNYZyU2MCV1MjAxODhuJXUyNTND,inputs=Q09ERSUyMEdPTEY_)
Explanation:
```
..‘             push a compressed string of the locomotive in a single line
   9n           split in line lengths of 9
     ,{         for each character in the input
       "..‘       push a compressed string of a wagon in a single line
           8n     split to line lengths of 8
             ┼    add horizontally
```
[Answer]
# C#, 277 Bytes
Golfed:
```
string T(string s){var o=new string[]{"     o O O","   o        ","   TS__[O]","  {======|","./ o--000'" };for(int i=0;i<s.Length;i++){o[0]+="   ___  ";o[1]+="| # |   ".Replace("#",s[i]+"");o[2]+="  |___| ";o[3]+="_|\"\"\"\"\"|";o[4]+="\"`-0-0-'";}return string.Join("\r\n",o);
```
Ungolfed:
```
public string T(string s)
{
  var o = new string[] { "     o O O", "   o        ", "   TS__[O]",
    "  {======|", "./ o--000'" };
  for (int i = 0; i < s.Length; i++)
  {
    o[0] += "   ___  ";
    o[1] += "| # |   ".Replace("#", s[i] + "");
    o[2] += "  |___| ";
    o[3] += "_|\"\"\"\"\"|";
    o[4] += "\"`-0-0-'";
  }
  return string.Join("\r\n", o);
}
```
Testing:
```
Console.Write(new AllAboardTheASCIITrain().T(""));
     o O O
   o        
   TS__[O]
  {======|
./ o--000'
```
And...
```
Console.Write(new AllAboardTheASCIITrain().T("Programming Puzzles & Code Golf"));
     o O O   ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___  
   o        | P |   | r |   | o |   | g |   | r |   | a |   | m |   | m |   | i |   | n |   | g |   |   |   | P |   | u |   | z |   | z |   | l |   | e |   | s |   |   |   | & |   |   |   | C |   | o |   | d |   | e |   |   |   | G |   | o |   | l |   | f |   
   TS__[O]  |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___| 
  {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./ o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
[Answer]
## C# 221 bytes
nothing special happening here.. just creating each line and join them with new lines.
```
s=>{var t=new[]{"    o O O","   o     ","  TS__[O]"," {======|","./o--000'"};foreach(var c in s){t[0]+="   ___  ";t[1]+=$"  | {c} | ";t[2]+="  |___| ";t[3]+="_|\"\"\"\"\"|";t[4]+="\"`-0-0-'";}return string.Join("\n",t);};
```
[Answer]
# [Jq 1.5](https://stedolan.github.io/jq/), 178 bytes
```
[["    o O O   o       TS__[O] {======|./o--000'"|_nwise(9)]]+[range(length)as$i|[.[$i:$i+1]|"   ___    | \(.) |   |___| _|\"\"\"\"\"|\"`-0-0-'"|_nwise(8)]]|transpose|map(add)[]
```
Expanded
```
# engine
def E:"    o O O   o       TS__[O] {======|./o--000'"|_nwise(9);
# car (note string interpolation)
def C:"   ___    | \(.) |   |___| _|\"\"\"\"\"|\"`-0-0-'"|_nwise(8);
  # generate train
  [[E]] + [range(length) as $i| [.[$i:$i+1] |C]]
  # combine rows and concatenate strings     
| transpose | map(add)[]
```
Sample run
```
$ jq -MRr train.jq <<< "golf"
    o O O   ___     ___     ___     ___  
   o       | g |   | o |   | l |   | f | 
  TS__[O]  |___|   |___|   |___|   |___| 
 {======|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
$ wc -c < train.jq
  178
```
[Try it online](https://jqplay.org/s/qzHO7pFazh)
[Answer]
# [C (clang)](http://clang.llvm.org/), ~~217~~ ~~212~~ ~~208~~ 193 bytes
```
f(*t){for(char*p,d[]="    o O O   o       TS__[O] {======|./o--000'   ___    | C |   |___| _|\"\"\"\"\"|\"`-0-0-'",i=0;i<5;i+=puts(""))for(write(1,d+i*9,9),p=t;d[57]=*p++;)write(1,d+45+i*8,8);}
```
-4 bytes thanks to ceilingcat!!
[Try it online!](https://tio.run/##XY7NasMwEITP9VMoukSSpUaFmCSoOrk/BEp9aG6OUY1dp4LUNo5KDnZeveq6IRTyDcvssnOYQhT7vN55XxHmaF81HSk@8461vEwzjRHQoAQ0@pnNmzFpkqFe/zHczhohpJRT@BljxsiAYhhwuAdkhi2@CNZ3IUFTzK2Wyt5Hyoa6/XYHgjGlY4FjZ90HueNlaNmKryhvtVNlGi0yzdowVPQ/MI8gs@RLqk7e1g595bYmNOjRNcFNRXCcPDyy5@Tlia1fWTzBVAUn/1NU@3x38OL4Cw "C (clang) – Try It Online")
[Answer]
# Excel VBA, 218 Bytes
Anonymous VBE immediate window function that takes input from range `[A1]` and outputs to the VBE immediate window
```
[B1]=[Len(A1)]:?"    o O O"[Rept("   ___  ",B1)]:?"   o     ";:For i=1To[B1]:?"  | "Mid([A1],i,1)" | ";:Next:?:?"  TS__[O]"[Rept("  |___| ",B1)]:?" {======|"[Rept("_|""""""""""|",B1)]:?"./o--000'"[Rept("""`-0-0-'",B1)]
```
## Formatted for readability
```
[B1]=[Len(A1)]
?"    o O O"[Rept("   ___  ",B1)]
?"   o     ";:For i=1To[B1]:?"  | "Mid([A1],i,1)" | ";:Next:?:
?"  TS__[O]"[Rept("  |___| ",B1)]:
?" {======|"[Rept("_|""""""""""|",B1)]:
?"./o--000'"[Rept("""`-0-0-'",B1)]
```
## Sample Output
```
    o O O   ___     ___     ___     ___     ___     ___     ___     ___     ___     ___     ___  
   o       | V |   | B |   | A |   |   |   | E |   | x |   | p |   | r |   | e |   | s |   | s | 
  TS__[O]  |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___|   |___| 
 {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
```
]