g | x | w | all
Bytes Lang Time Link
nanAWK250303T182908Zxrs
nanPerl 5 plF250303T184539ZXcali
nanForth gforth240730T150755Zreffu
nanUiua240730T121032ZEurope20
nanThunno 2 GB230720T084337ZThe Thon
nanVyxal 2.4.1 K230720T113843Zlyxal
nanNekomata230720T103252Zalephalp
nanRaku Perl 6 rakudo230720T074215Zbb94
nanPowerShell230604T184855ZJames Fl
nanArturo230604T181146Zchunes
nanC clang221128T194236Zc--
nanWolfram Language Mathematica230406T001454Z138 Aspe
nanPython 3230405T193320ZCreative
nanVyxal221128T195648ZnaffetS
nanGo230330T180048Zbigyihsu
nanStax230310T185714Zemirps
nanMATL230310T194437Zbeaker
nanKamilaLisp v0.2230310T194222ZKamila S
143Lua230309T200720Zemirps
106Java 8230210T181616ZFhuvi
008GolfScript230209T202428Zemirps
nanPython 3221219T120029ZU13-Forw
nanAPL221130T195302ZMark Ree
nanPHP221130T163343ZKaddath
9818C# Visual C# Interactive Compiler221129T172446ZTheLetha
nanFactor221130T060219Zchunes
nanK ngn/k221130T022212Zdoug
039Alumin221129T212746ZConor O&
nanBurlesque221130T002258ZDeathInc
nanPyth221129T205534Zisaacg
033Perl 5 plF''221129T121043ZKjetil S
048Excel221128T213601Zjdt
nanJava 8221129T144436ZKevin Cr
035Charcoal v221128T190231ZNeil
7016J221129T095715Zm90
025Raku221129T133444Zhkdtam
nanJulia221129T140001ZKirill L
3850Nibbles221128T210024ZDominic
nan><>221129T095249ZEmigna
nanLy221129T104340Zcnamejj
nanJavaScript Node.js221129T095122ZArnauld
006MathGolf221129T090517ZKevin Cr
124405AB1E221129T084711ZKevin Cr
nanHusk221129T083758ZDominic
nanR221129T072823Zpajonk
nanJ221129T013647Zsouth
019q221129T003637Zcillianr
nanJuby221129T000306ZJordan
nanTerse221128T231516ZGymhgy
nanHaskell221128T212409Zcorvus_1
nanBash + GNU utilities221128T202447ZDigital
nanRuby221128T184650ZJordan
050Octave221128T195447ZLuis Men
030MATL221128T194827ZLuis Men
nanPip221128T191848ZDLosc
nanJelly221128T181303ZJonathan
nanPython221128T182113ZMukundan
nanSequences221128T173017ZThe Thon

AWK, 71 bytes + 115 range = 186

@load "ordchr"
{for(m=1e9;i++<NF;x<m&&m=x){x=ord($i);x>M&&M=x}}1,$0=M-m

Attempt This Online!

Perl 5 -plF, 32 bytes + 80 range = 112

$_=ord((@a=sort@F)[-1])-ord$a[0]

Try it online!

Forth (gforth), 62 bytes + 56 range = 118

: F BOUNDS 0 128 2SWAP DO I C@ MIN SWAP I C@ MAX SWAP LOOP - ;

Try it online!

Explanation

Loops through the string, keeping track of the min and max ascii code on the stack, then subtracts them at the end. Forth words are case insensitive, so using all uppercase saved some range in the score without affecting the functionality.

Code Explanation

: f (addr len -- n)  \ Start new word definition
  bounds     \ get the start and end address of the string
  0 128      \ create default max (0) and min (126) variables on the stack
  2swap do   \ move the addresses back into position and start a loop
    i c@ min \ get the current char and compare with the min
    swap     \ move result back on the stack
    i c@ max \ get the current char and compare with the max
    swap     \ move result back on the stack
  loop       \ end the loop
  -          \ subtract the min from the max
;            \ end the word definition

Uiua, 23 bytes + 20 range = 43

subbotfironrevselrisdup

Try it here!

Explanation

-∩⊢⟜⇌⊏⍏.
      ⊏⍏. sort the array (by codepoints)
   ⟜⇌     get its reverse but keep the original on top
 ∩⊢       get the first element of both arrays, resulting in the first and last elements
-         get their difference

Thunno 2 GB, 2 + 24 = 26

G_

Try it online!

Port of lyxal's Vyxal answer.

Explanation

G_  # Implicit input
    # Convert to codepoints
G   # Maximum codepoint
 _  # Subtract each input codepoint
    # Find the maximum
    # Implicit output

Vyxal 2.4.1 K, 4 bytes + 26 range = Score 30

G?-G

Try it Online!

If I knew what I was doing in 2021, this could have been 3 bytes with the G flag, but I never did figure out how to make the K flag play nice with other flags.

Explained

G?-G­⁡​‎‎⁡⁠⁡‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁣​‎‎⁡⁠⁤‏‏​⁡⁠⁡‌­
G     # ‎⁡Greatest character in the input
 ?-   # ‎⁢With each character code subtract from it
   G  # ‎⁣Greatest of those
💎

Created with the help of Luminespire.

Nekomata, 6 bytes + 66 = 72

eo:h-l

Attempt This Online!

eo:h-l
e       Convert to codepoints
 o      Sort
  :     Duplicate
   h    Head
    -   Subtract
     l  Last

Raku (Perl 6) (rakudo), 16 bytes + 78 = 94

+*.ords.minmax-1

Attempt This Online!

PowerShell, 58 bytes + 93 = 151

$args|%{$a=($_|% t*y)|%{[byte][char]$_}|sort;$a[-1]-$a[0]}

Try it online!

Arturo, 31 bytes + 33 = 106 94 64

function[x][do[x|min]x|max|sub]

Try it!

C (clang), 79 bytes + 28 = 145 138 129 112 111 107

-7 score thanks to @Digital Trauma
-9 -10 score thanks to @jdt

A,B;D(*C)??<*C<A?A=*C:*C>B?B=*C:0;*++C?D(C):0;??>C(*C)??<A=B=*C;D(C);*C=B-A;??>

Try it online!

Explanation

??< and ??> are trigraphs for { and } respectively

A,B;      // A will track the minimum, B will track the maximum
D(*C){    // D() will traverse C updating the values of A and B
  *C<A?   // if current character < A
    A=*C  //   update A with it's value
  :*C>B?  // else if current character > B
    B=*C  //   update B with it's value
  :0;     // else, do nothing
  *++C?   // if we're not at the end of the string
    D(C)  //   call D recursively with the next character
  :0;     // else, do nothing
}         // end D()
C(*C){    // C() takes the string, which is also where we'll store the output
  A=B=*C; // initialize A and B with the first character in C
  D(C);   // call D
  *C=B-A; // store the range (max - min) in the out argument
}         // end C()

Wolfram Language (Mathematica), 31 bytes + 85 = 116

ToCharacterCode@s//Max@#-Min@#&

Try it online!

Python 3, 39 bytes + 80 range = 119

print(ord(max(a:=input()))-ord(min(a)))

Try it online!

A full program is one point better here because it avoids the minimum character " " (32) for "(" (40).

Vyxal, 6 bytes + 67 = score 73

C:G$g-

Try it Online!

Go, 95 bytes + 93 = 188

func(s string)int{m:=rune(s[0]);n:=m;for _,r:=range s{if m<r{m=r};if n>r{n=r}};return int(m-n)}

Attempt This Online!

Stax, 2 bytes + 57 = 59 score

:s

Run and debug it

Apparently there's a builtin...

MATL, 3 bytes + 32 = 35

Sds

Explanation

Sds
S     % Sort implicit input
 d    % Difference between adjacent elements
  s   % Sum the values

Try it online!

KamilaLisp v0.2, 88 + 35 = 123

[- $(foldl1 max) $(foldl1 min)]@ucs

Lua, 66 57 bytes + 89 86 = score 155 143

s=...print(math.max(s:byte(1,#s))-math.min(s:byte(1,#s)))

Try it online!

Program which takes command line argument for the strings.

Java 8, 106 108 bytes + 80 range = score 186 188

-2 bytes thanks to @ceilingcat

s->(s.chars().reduce(0,(a,b)->a>0?b>a>>16?b*65792-a%256*255:b<a%256?a/65536*65792-b*255:a:b*65537)>>8)%256

Try it online!

There is a better Java solution already posted, but maybe my answer could interest some people.

I'm not sure how to properly explain it, but by trying to keep only 1 inline Java stream, my goal was to carry 3 numbers < 256 inside only 1 integer ("a", the accumulator of the stream reduction) using this structure:
[_____max_value_____] [difference_between_max_and_min] [____min_value____]
<- 65 536 and over -> <- from 256 to 65 535 -> <- from 0 to 255 ->

GolfScript, 8 bytes, score 64

$(\)@-\;

Try it online!

Explanation

char     : usage                                : stack
$        : ($)ort the (implicit) input          : <sorted input>
 (       : take the first element out           : <sorted input> <first item>
  \      : swap the top two values of the stack : <first item> <sorted input>
   )     : last item                            : <first item> <sorted input> <last item>
    @    : rotate the stack                     : <sorted input> <last item> <first item>
     -   : subtract, giving us the range        : <sorted input> <range>
      \  : swap the top two values on the stack : <range> <sorted input>
       ; : discard the top of the stack         : <range>
(after which the stack is implicitly output)

Python 3, 32 bytes + 88 = 120

lambda x:ord(max(x))-ord(min(x))

Try it online!

APL, 11 chars + 9069-codepoint range = 9080.

(In Dyalog one-byte encoding, range is 186 for a total of 197.)

(⌈/-⌊/)⎕UCS

Try it online!

PHP, 39 bytes + 84 -> 123

fn($s)=>max($a=unpack('C*',$s))-min($a)

Try it online!

EDIT: OK this time I admit functional approach is way better :P

OLD VERSION:

PHP, -F 67 bytes + 78 -> 145

for($n=INF;$c=ord($argn[$i++]);$c<$m?:$m=$c)$c>$n?:$n=$c;echo$m-$n;

Try it online!

I wanted to give it a shot without arrays / min / max, in my traditional horrific-full of dollars-for loop Style and try to optimize for ASCII range rather. Stupid $argn cannot be in full caps. funny that it gives the same score like this (caps and no space nor brackets was the original plan):

PHP, -F 88 bytes + 57 -> 145

FOR($N=INF;$C=ORD($GLOBALS[STRTOLOWER(ARGN)][$I++]);$C<$M?:$M=$C)$C>$N?:$N=$C;ECHO$M-$N;

Try it online!

C# (Visual C# Interactive Compiler), 98 score (18 bytes)

ASCII range: 80
Length: 18
Total score: 98

s=>s.Max()-s.Min()

Try it online!


C# (Visual C# Compiler), 125 score (36 bytes)

ASCII range: 89
Length: 36
Total score: 125

s=>s.Max()-s.Min()

If we're going traditional through the compiler then we have to include an extra 18 bytes for using System.Linq;

Try it online!

Factor, 70 range + 21 bytes = 91 score

math.statistics:range

enter image description here

Requires modernish Factor for fully-qualified word syntax, hence nothing online will suffice.

K (ngn/k), 12 bytes + 86 = 98 13 bytes + 56 = 69

h/t @isaacg

+/1_-':@/1<:\

Try it online!

Alumin, 36 19 bytes + 22 20 = 58 39

idiqdhhhwrvsruripkc

Try it online!

Both the right language for the job, and horribly inefficient at it! Turns out, I'm just an inefficient thinker!

Explanation

idiqdhhhwrvsruripkc
                       explanation           | stack
id                     take input, duplicate | MAX MIN
  iq           ip      while input > 0       | MAX MIN in
    d                    duplicate           | MAX MIN in in
     hhhw                grab top 3          | MAX [ MIN in in ]
         r               reverse stack       | MAX [ in in MIN ]
          v              get lesser of two   | MAX [ in MIN' ]
           s             ungrab              | MAX in MIN'
            r            reverse stack       | MIN' in MAX
             u           get greater of two  | MIN' MAX'
              r          reverse stack       | MAX' MIN'
                         (this gives us a better score than using `y` to swap 2)
                      loop finishes          | MAX MIN -1
                 k    discard eof            | MAX MIN
                  c   subtract               | MAX-MIN

Explanation (Old)

hqidrlhcwrspkrklhhgwfufsykrlhcwfvfsc
h                                     push 1 (to start loop)
 q         p                          input loop
  id                                  take input, duplicate
    r                                 reverse stack
     lhc                              stack length - 1
        wrs                           reverse that many elements off the stack
                                      this has the effect of pushing two copies of the input
            krk                       pop trailing EOF twice
               lhhg                   stack length / 2
                   w                  grab that many elements into a new stack
                    fuf               fold over maximum
                       sykr           place on bottom stack, remove initial 1
                           lhc        stack length - 1
                              w       grab that many elements as before
                               fvf    fold over minimum
                                  sc  push and subtract

Burlesque, 12 bytes + 52 = 64

)**J>]\/<].-

Try it online!

)**  # Map to char code
J    # Duplicate
>]   # Maximum
\/   # Swap
<]   # Minimum
.-   # Difference

Pyth, 8 bytes + 34 = 42

+F.+CDCM

Try it online!

Using .+ is golfier than h and e, and also stays within the established ASCII value range.

Perl 5 -plF'' 33 bytes + 84 = 117

@_=map ord,sort@F;$_=$_[-1]-$_[0]

Try it online!

Excel, score = 103 94 (length 46, range 48)

-9 score thanks to Engineer Toast

=LET(A,CODE(RIGHT(A1,ROW(A:A))),MAX(A)-MIN(A))

enter image description here

Java 8, score: 134 (54 bytes)

s->s.chars().max().orElse(0)-s.chars().min().orElse(0)

Try it online (also contains code to extract the lambda function from the code-block and calculate its score: (max_codepoint - min_codepoint) + length).

Not too much too improve unfortunately.

Explanation:

s->            // Method with String parameter and integer return-type
  s.chars()    //  Convert the String to an IntStream of codepoint integers
   .max()      //  Get the maximum of these codepoints
   .orElse(0)  //  Convert the OptionalInt to an int
               //  (`.orElse(0)` is 1 byte shorter than `.getAsInt()`)
  -            //  And subtract
   s.chars().min().orElse(0)
               //  The same to get the minimum codepoint

Charcoal -v, 35 bytes, score 61

castminusordceilceil[q]ordminmin[q]

Try it online! Abusing Charcoal's verbose parser again. In order for it to recognise q as a variable name I can't follow it with a letter, so the next nearest suitable characters are the list delimiters. I've also used ceil instead of max to avoid using an x; this costs 2 bytes but overall saves 1 from my score. Normally the program would be written like this:

Print(Cast(Minus(Ordinal(Maximum(q)), Ordinal(Minimum(q)))));

The best I could do in succinct Charcoal was a score of 10135:

⭆ψ⁻℅⌈θ℅⌊θ

Try it online! Link is to verbose version of code. Explanation: The limiting factors here are the Greek letter θ needed for the two occurrences of the input variable (the only other input method uses which has a ridiculously high Unicode code point of 65531) and the used to stringify the result (again, would have had far too high a code point).

 ψ          Predefined string null character
⭆           Map over characters and join
     θ      Input string
    ⌈       Maximium
   ℅        Ordinal
  ⁻         Minus
        θ   Input string
       ⌊    Minimum
      ℅     Ordinal
            Implicitly print

If using bytes from Charcoal's code page was allowed, its score would "only" be 210:

SαI⁻℅⌈α℅⌊α

Try it online! Link is to verbose version of code. Explanation: The limiting factors here are that (Minimum) is byte index 25 while α (variable a) is byte index 225, although I did reduce my score by 14 by taking the input into α rather than the default input of θ (variable q, byte index 241).

S           Input as a string
 α          Store in variable `a`
      α     Input string
     ⌈      Maximum
    ℅       Ordinal
   ⁻        Subtract
         α  Input string
        ⌊   Minimum
       ℅    Ordinal
  I         Cast to string
            Implicitly print

J, score 70 (16 bytes, range 54)

[:+/2-/\a.I.]\:]

Try it online!

Raku, 25 bytes

ASCII range: 88 Length: 25 Total score: 113

[-] @_.ords.minmax[*-1,0]

Try it online!

Julia, 22 bytes + 80 = 102

+s=-(-(extrema(s)...))

Attempt This Online!

Nibbles, 9 12 bytes + 56 49 38 = 50

;*;-;o;/;\;`<@@o;/_$;`$$

This corresponds to the Nibbles program with nibbles:

6 a 6 9 6 e 6 a 6 b 6 e 4 d 4 e 6 a 5 3 6 d 7 3

Which, paired-up into bytes, gives

6a 69 6e 6a 6b 6e 4d 4e 6a 53 6d 73

which can be read-out as a string (with the same ASCII values)

jinjknMNjSms

with ASCII range 115 (73) - 77 (4d) = 38.


How? We start from a straightforward code-golf solution to the question: -o/\;`<$$o/ (5.5 bytes, 11 nibbles):

-o/\;`<$@o/
-                   # subtract
 o                  #   character value of
  /                 #   fold over
   \                #     reverse of
    ;               #     (save)
     `<             #     sorted
       @            #     input
        $           #   returning left element each time
                    #   (so the fold returns the first element)
                    # from
         o          #   character value of
          /         #   fold over
                    #   (implicit) saved sorted input
                    #   (implicit) returning left element each time

The nibbles are slightly re-arranged in the final program, since the 2-nibble 'sort' function ( `<) wraps around its argument (here $). Thus, the paired-up nibbles from this are:

-o /\ ;` @< $o /    # program code (in final order)
9e ab 6e 4d 3e a    # nibbles

We can reduce the range of bytes by inserting 'save' operators (;, nibble 6) to shift high-valued nibbles into the least-significant-nibble position of each byte.
This doesn't affect the output, but we need to override the final implicit variable to account for the saved (but ignored) values. Hence:

;- ;o ;/ ;\ ;` @< $o ;/ ;$   # program code (in final order), with final variable changed to ;$
69 6e 6a 6b 6e 4d 3e 6a 63   # nibbles

Modifying both folds (so returning right element @ instead of left element $) avoids the lowest byte 3e, but unfortunately outputs a negated value.
So we multiply (and save: ;*) the negated value by its own sign (also saved: ;`$): this corrects the output, introducing a new highest byte of 73, but the overall score is still reduced.

enter image description here

><>, Score: 50 bytes + 74 = 124

0ff*i:0(ee+*98++0.:@:@$:@)?$?>@$:@$:@(?$?>$30.@-n;

Try it online!

Explanation

Initialize max = 0 and min = 225.
Then go through the input and update these values as needed.
At the end, print max - min.

Range Max: n = 110
We need n to print a number, so there isn't much we can do about this.

Range Min: $ = 36
$ swaps the top 2 values of the stack. Replacing it could save 6 on the range, but since we are using it in 6 places it seems unlikely that could we could save on the score by the reducing the range.

Code

We've replaced ~ = 126 with ? and r = 114 with @$ which saves 16 on the range at the cost of 3 bytes.

We've replaced the line feed = 10 with jumps . = 46 which saves 26 on the range at the cost of 6 bytes.

Ly, 8 bytes + 70 = 78

ia0I-s>l

Try it online!

I found a shorter program, but the character range of the code was big enough that it had a higher total score.

ia        - read STDIN onto stack as codepoints, sort the stack
  0I      - copy the bottom of the stack to the top
    -     - subtract to get the range
     s>l  - save result, switch to clean stack, load result

JavaScript (Node.js), 42 bytes + 80 = 122

s=>Math.max(...b=Buffer(s))-Math.min(...b)

Try it online!

MathGolf, score: 200 191 (4 6 bytes†)

†: MathGolf uses Code page 437.

$_╙\╓-

Increased the byte-count to slightly improve the score, but this is pretty hopeless.. The ord builtin $ is too far apart from most of the other useful builtins like min()/max()/sum(Σ)..

Input as a list of characters.

Try it online.

Explanation:

$       # Get the codepoint integers of each character in the (implicit) input-list
 _      # Duplicate it
  ╙     # Pop and push its maximum
   \    # Swap
    ╓   # Pop and push its minimum
     -  # Subtract this minimum from the maximum
        # (after which the entire stack is output implicitly)

05AB1E, score: 158 124 (4 bytes)

Ç{¥O

Try it online or verify all test cases or verify its score.

Explanation:

Ç     # Get a list of codepoint integers of the (implicit) input-string
 {    # Sort them
  ¥   # Get the forward differences/deltas
   O  # Sum those together
      # (after which the result is output implicitly)

Husk, 11 bytes + 63 = 74

ASz>o;FYOmc

Try it online!

ASz>o;FYOmc
         m   # map over input
          c  #   getting character values
        O    # and sort into ascending order;
  z          # now, zip together
   >         # getting differences
 S           #   the sorted list itself
             # and
    o;       #   the single-element list of
      F      #   fold over the sorted list
       Y     #   getting pairwise maxima
A            # finally, get the average
             # of the resulting single-element list.

R, 29 bytes + 77 = 106

\(a)diff(range(utf8ToInt(a)))

Attempt This Online!

Seems that most golfy approach has also the lowest score, since we need to use utf8ToInt() and it has the range of 77 by itself.

J, score = 15 + 79 = 94

[:(>./-<./)3&u:

Attempt This Online!

[:(>./-<./)3&u:
[:               NB. enforce f (g y)
           3&u:  NB. convert string to list of char codes
  (       )      NB. monadic fork
       <./       NB. min
   >./           NB. max
      -          NB. subtract

q, 19 bytes

(-/)7h$(max;min)@\:

k4, 17 bytes

(-/)7h$(|/;&/)@\:

J-uby, 21 bytes + 87 = 108

:bytes|:-%[:max,:min]

Attempt This Online!

Terse, 7 bytes + 6769 = 6776

找没最手样找到

Try it here

Could be worse.

找        Char codes
 没       Maximum, after
  最手      Squaring and then square root (identity)
    样    Subtract
     找到  Minimum

Haskell, 27 bytes + 84 = score 111

_?s=(maximum$s)-(minimum$s)

Attempt This Online!

Bash + GNU utilities, 52 bytes + 92 range = 144

od -An -w1 -td1 -v|sort -n|sed -n '1p;$p'|dc -e??r-p

Try it online!

Ruby, 26 bytes + 80 = 106

-2 bytes thanks to Steffan

->s{y=s.bytes;y.max-y.min}

Attempt This Online!

Octave, score 56 (length 6, range 50)

@range

Try it online!

MATL, score 37 (length 7, range 30)

X>GX<ZP

Try it online! Or verify all test cases and source code.

X>    % Implicit input. Maximum
G     % Push input again
X<    % Minimum
ZP    % Distance (of code points). Implicit display

Pip, 13 bytes + 39 = 52

a:A^aMXaADMNa

Try It Online!

Explanation

A straight code-golf solution to the challenge might look like this:

A*:a;Ma-Na
   a        First command-line argument
A*          Get ASCII value of each character
  :         and assign that list of integers back to a
    ;       Statement separator
        Na  Minimum of a
      a-    Subtract that from each element in a
     M      and take the maximum of the resulting list

This gets a score of 65. The a for getting the command-line argument and A for taking ASCII values are both necessary, so to improve the score we'll need to look at the characters with ASCII values less than A.

The smallest character is *, which we can get rid of by splitting the string into a list of characters with ^ and passing that list to A directly:

A*:a
 ->
a:A^a

The next-smallest character is -, which we can get rid of by using the absolute difference operator AD instead. Then we have to rearrange a bit more to avoid needing a space; we'll use the old MX and MN operators for max and min instead of the newer M and N.

Ma-Na
 ->
MXaADMNa

(We could also keep using M, but since it also requires a semicolon to parse correctly, the score is the same if we replace it with MX which doesn't need the semicolon.)

Jelly, 5 bytes + 149 = 154

I think this is about as good as it's going to get in Jelly due to the distance between O (unavoidable as it's the only way to get the ordinals of the input string) and the large ordinals of Unicode characters representing the bytes for mapping and getting maximums and minimums, index into a list etc.

OÞOIS

A monadic Link that accepts a list of characters and yields the range size as an integer.

Try it online!

How?

OÞOIS - Link: list of characters        (ordinal)
 Þ    - sort by:                        (222)
O     -   ordinal value                 (79)
  O   - ordinal values                  (79)
   I  - forward differences             (73)
    S - sum                             (83)
                                        ----
                                         222
                                       -  73
                                        ====
                                         149

Python, 39 + 80 = 119

print(ord(max(s:=input()))-ord(min(s)))

Attempt This Online!

Sequences, score = 73 + 4.12 = 77.12

(Sequences uses the 96 printable ASCII characters as its codepage, so the byte count of this program is \$5\log_{256}(96) \approx 4.12\$)

`vMm-

Explanation

`vMm-  # Implicit input as a string
`v     # Get the ASCII values of the input string in a list
  M    # Get the maximum value of that list
   m   # Get the minimum value of that list
    -  # And subtract to find the range
       # (implicit output)