A dollar word is a word where when each of its letters is given a cent value, from a = 1 to z = 26, and the letters are summed, the result is 100. Here is an example on CodeReview, and here is a list of dollar words I found online.


Input will be alphabetical from a-z, in your one language's text datatypes (arrays are allowed). You do not need to account for any other input - there will be no spaces, apostrophes, or hyphens. You can take as lowercase, uppercase, or a combination. Trailing newlines are allowed.


Output a truthy value if the input is a dollar word, and a falsey value if it is not.

Test Cases





This is code-golf, so the shortest answer in bytes wins! Standard loopholes and rules apply. Tie goes to first poster.

  • 25
    \$\begingroup\$ Title has dollar words in it, sorry if it threw you off. \$\endgroup\$
    – Stephen
    Apr 18, 2017 at 20:56

83 Answers 83


05AB1E, 8 bytes



Uses the CP-1252 encoding. Try it online!


Ç          # Convert the string into a list of character codes
 96-       # Subtract 96 of each element
    O      # Take the sum
     4b    # Push 100 (4 in binary)
       Q   # Check if equal
  • 2
    \$\begingroup\$ Tn works too :P \$\endgroup\$ Apr 19, 2017 at 14:34
  • \$\begingroup\$ Ç4+OTn%0Q was another idea I had, but it's worse. \$\endgroup\$ Apr 19, 2017 at 17:25
  • \$\begingroup\$ 7 bytes \$\endgroup\$
    – lyxal
    Dec 8, 2021 at 0:56
  • \$\begingroup\$ @lyxal No need for uppercase, the 4b in the current answer can simply be т for 7 bytes. \$\endgroup\$ Dec 8, 2021 at 11:51

Python, 39 38 bytes

lambda s:sum(ord(i)-96for i in s)==100

Try it online!

-1 byte thanks to @JonathanAllan


MATL, 8 bytes


Uses lowercase input.

Try it online!


The code is as readable as it gets:

96-   % Implicitly input string. Subtract 96 from each char interpreted as ASCII code
s     % Sum of array
100=  % Does it equal 100? Implicitly display

Raku, 21 bytes

{100==[+] .ords X%32}

Try it


{Ⅽ==[+] .ords X%32}

Try it

Note that the is ROMAN NUMERAL ONE HUNDRED U+216D with a unival of … 100
Which takes 3 bytes to encode.


{  # bare block lambda with implicit parameter $_

  100     # is 100
  ==      # equal to
  [+]     # the sum of the following

    .ords # the ordinals of the input (implicit method call on $_)
    X[%]  # crossed using the modulus operator
    32    # with 32 to get 65..90 or 97..122 to become 1..26

GS2, 6 bytes


Input must be in uppercase.

Try it online!

How it works

  Θ       Combine the previous two tokens into a block and map it over the input.
▲             Push 64.
 1            Subtract 64 from the character on the stack.
   d      Take the sum of the resulting character array.
    ←     Push 100.
     q    Compare the two items on the stack for equality.

JavaScript (ES6), 46 bytes

Returns 0 or 1.

let f =



  • \$\begingroup\$ Interestingly when I tried reduce and recursion they both came out 2 bytes longer. \$\endgroup\$
    – Neil
    Apr 19, 2017 at 0:06
  • \$\begingroup\$ @Neil Actually, it was using reduce() during the first few minutes of the grace period when I initially posted it. \$\endgroup\$
    – Arnauld
    Apr 19, 2017 at 10:50

Mathematica, 23 bytes


Pure function taking a string (or an array of letters) as input, case-insensitive, and returning True or False. Here Tr just adds the letter-numbers together; everything else is self-explanatory.


Haskell, 32 bytes

f s=sum[1|c<-s,_<-['a'..c]]==100

Try it online!

The idea is to make a list of characters from a to the given character for each character in the list, and check that the total length is 100.

Other attempts:

f s=sum[1|c<-s,_<-['a'..c]]==100

f s=sum[fromEnum c-96|c<-s]==100
f s=100==length((\c->['a'..c])=<<s)
(==100).length.(>>= \c->['a'..c])
(==100).length.(enumFromTo 'a'=<<)
f s=100==length(do c<-s;['a'..c])

Too bad enumFromTo is so long.

  • 1
    \$\begingroup\$ You're right that the length is a shame—(100==).length.(enumFromTo 'a' =<<) is such a clean use of point-free-ness \$\endgroup\$ Apr 19, 2017 at 23:58

C, 45 43 bytes

Thanks to @Neil for saving two bytes and making the solution case-insensitive!


Try it online!

  • \$\begingroup\$ Seems like you can save a byte by setting n=0 globally and then skipping the first clause of the loop spec, no? edit: never mind—I guess that would only work for the very first call. \$\endgroup\$ Apr 18, 2017 at 21:23
  • 3
    \$\begingroup\$ Could counting down from 100 save bytes? Also, &31 might work to make your code case insensitive. \$\endgroup\$
    – Neil
    Apr 19, 2017 at 0:09
  • \$\begingroup\$ Out of curiosity, how does n=!n work? I understand it checks if n is zero, because based on some test I see !0 returns 1; !15 returns 0; and !-15 returns 0 as well. But why? Which operand is ! in C when using it as !integer? \$\endgroup\$ Apr 19, 2017 at 12:11
  • \$\begingroup\$ @KevinCruijssen ! is just the logical not. In C, 0 means false, and any other integer value means true. So !0 == 1, and !n == 0 for every n != 0. \$\endgroup\$
    – Steadybox
    Apr 19, 2017 at 12:15
  • \$\begingroup\$ @Steadybox Ah, I didn't knew this part: "and any other integer value means true", but it indeed makes sense. I always (incorrectly) thought of it as 0=false; 1=true instead, hence my confusion. Thanks for the answer. \$\endgroup\$ Apr 19, 2017 at 12:39

Haskell, 32 bytes

f w=sum[fromEnum c-96|c<-w]==100

This works for lowercase input. For uppercase, s/96/64/. Mixed-case support would add a bunch of bytes.


Jelly, 9 7?* 8 bytes


Full program, outputting 1 if the input is a dollar word, or 0 if not.

Try it online!


ɠO%32S⁼³ - Main link
ɠ        - read a line of input from STDIN
 O       - cast to ordinals
  %32    - mod 32 (vectorises) (-3*32=96 from lowercase; -2*32=64 from uppercase)
     S   - sum
       ³ - literal: 100
      ⁼  - equal?

* Could it be 7 bytes?

The only reason this took input with ɠ was to keep ³ as the literal 100 rather than the 3rd command line input (1st program input).

A way to avoid that would be, as pointed out by Dennis, to create 100 using the raw literal form ȷ2 which is 102. This leads to another 8 byte O%32S=ȷ2, but this is now an unnamed monadic function (as well as operating as a full program with a 3rd argument).

Since, in golf, one may create variables or helper functions which restrict the program in which they may reside (one cannot reuse the name in-scope without stopping the function from being reusable), maybe restricting the program to only taking input from STDIN may also be acceptable, in which case the 7 byte O%32S=³ would be acceptable here as an unnamed function.

  • 1
    \$\begingroup\$ Alternatively, O%32S=ȷ2. Works for uppercase and lowercase input. \$\endgroup\$
    – Dennis
    Apr 18, 2017 at 21:18
  • \$\begingroup\$ @Dennis It may be borderline but wouldn't O%32S⁼³ actually be a valid entry as it does define an unnamed, reusable function, so long as the rest of the program it is in does not use command line arguments for input? \$\endgroup\$ Apr 18, 2017 at 21:43
  • \$\begingroup\$ Hm, I guess that could be done. Not that different from using a global variable in C, for example. \$\endgroup\$
    – Dennis
    Apr 18, 2017 at 21:59

Alice, 23 bytes


Try it online!

Input should be lower case. Prints 1 for dollar words and 0 otherwise.


Time to show off Alice's tape and some advanced control flow. Despite being fairly good at working with integers and strings individually, Alice has no built-ins to a) determine a string's length, b) convert between characters and their code points. The reason for this is that all of Alice's commands either map integers to integers or strings to strings. But both of those would require mapping strings to integers or vice versa, so they don't fit into either of Alice's modes.

However, in addition to it's stack, Alice also has a tape and Cardinal and Ordinal mode interpret the data on the tape in different ways

  • In Cardinal mode, it's a regular tape familiar from other languages like Brainfuck. You can store one integer in each cell and you can move a tape head around. The tape is infinitely long and initially holds a -1 in every cell. The cells are also indexed and the tape head starts at index 0.
  • Ordinal mode has its own tape head (also starting at index 0) and it interprets the tape as a list of strings. Strings are terminated by non-character cells (i.e. any values which are not a valid Unicode code point), in particular -1. So for Ordinal mode, the tape is initially filled with empty strings.

This tape can be used for both of the above operations: to get a string length, we write it to the tape in Ordinal mode, seek the terminating -1 in Cardinal mode and retrieve the position of the tape head. To convert characters to their code points, we simply read them off the tape in Cardinal mode.

The other two important features used in this solution are the return stack and an iterator. Alice has a return stack which is usually filled when using the jump command j, and which you can pop an address from to jump back with k. However, it's also possible to push the current address to the return stack without jumping anywhere with w. If we combine w with the repeat command &, we can push the current address to the return stack n times. Now each time we reach k, one copy is popped off the return stack and we perform another iteration from w (starting at the cell after it, because the IP moves before executing another command). When the return stack becomes empty, k does nothing at all and the IP simply passes through. Hence &w...k pops an integer n and then executes ... n+1 times, which gives us a very concise way to express a simple for loop.

On to the code itself...

/     Reflect to SE. Switch to Ordinal.
i     Read the input word as a string.
      Bounce off bottom boundary, move NE.
!     Store the input word on the tape.
      Bounce off top boundary, move SE.
/     Reflect to E. Switch to Cardinal.
e     Push -1.
)     Seek right on the tape for a -1, which finds the -1 terminating
      the input word.
q     Push the tape head's position, which gives us the string length N.
&w    Repeat this loop n+1 times (see above for an explanation)...
  [     Move the tape head left by one cell.
  ?     Retrieve the code point of the character in that cell.
  '`    Push 96.
  -     Subtract it from the code point to convert the letters to 1...26.
  +     Add the result to a running total. This total is initialised to 
        zero, because in Cardinal mode, the stack is implicitly filled with
        an infinite amount of zeros at the bottom.
k    End of loop.
     Note that the above loop ran once more than we have characters in the
     string. This is actually really convenient, because it means that we've
     added a "-1 character" to the running total. After subtracting 96 to
     convert it to its "letter value" this gives 97. So dollar words will
     actually result in 100 - 97 = 3, which we can check against for one
     byte less than for equality with 100.
3-   Subtract 3 to give 0 for dollar words.
n    Logical NOT. Turns 0 (dollar words) into 1 and everything else into 0.
     The IP wraps around to the beginning of the first line.
\    Reflect to NE. Switch to Ordinal.
o    Implicitly convert the result to a string and print it.
     Bounce off top boundary, move SE.
@    Terminate the program.
  • \$\begingroup\$ Nice! I got 41 with my first try \$\endgroup\$
    – user41805
    Apr 19, 2017 at 10:09

R, 55 54 bytes


-1 byte thanks to BLT

  • returns a function that does the required computation, which returns TRUE and FALSE as one would expect.

  • takes input in as lowercase; would only be a switch from letters to LETTERS for all uppercase

  • 1
    \$\begingroup\$ function(x)sum(match(el(strsplit(x,"")),letters))==100 saves a byte. \$\endgroup\$
    – BLT
    Apr 19, 2017 at 0:35

Ruby, 25 bytes


Works for uppercase.

I see a couple of more complex Ruby entries, but it really is this simple. s.sum adds the ASCII codes of the input string, and from this we subtract 64 times the length of the string.

Example of use


puts f["ZZZ"]
  • \$\begingroup\$ This only works on Ruby 2.4 and currently does not work on TIO \$\endgroup\$
    – G B
    Apr 24, 2017 at 5:51
  • 1
    \$\begingroup\$ @GB thanks for the comment but I'm running on 2.2.6 and it works fine for me. The feature has been documented since 1.9.3. It works on TIO.run and Ideone.com for me too. \$\endgroup\$ Apr 24, 2017 at 19:32
  • \$\begingroup\$ You are right, I thought it was the same as Array#sum, which is new in 2.4 \$\endgroup\$
    – G B
    Apr 25, 2017 at 5:29
  • \$\begingroup\$ Actually, it's not the sum of ASCII values, the definition is "Returns a basic n-bit checksum of the characters in str". This works in this case, of course. \$\endgroup\$
    – G B
    Apr 26, 2017 at 9:34

Java 8, 36 bytes


Try it online!

Note: case independent.


05AB1E, 9 bytes


Try it online!


As 1 is the only truthy value in 05AB1E we can save a byte using subtraction over comparing to 100.

5b         # convert 5 to binary (results in 101)
  Iv       # for each letter in input word
    Ayk    # get the index of the letter in the alphabet
       >   # increment
        -  # subtract from total

Perl 5, 30 bytes

-1 byte thanks to @Neil (31& instead of -96+).

29 bytes of code + -p flag.

$@+=31&ord for/./g;$_=$@==100

Try it online!

  • \$\begingroup\$ Can you use 31&ord instead? \$\endgroup\$
    – Neil
    Apr 19, 2017 at 0:07
  • \$\begingroup\$ @Neil Hum... I've always been using -96+ for such things.. Thanks a lot for that! (but now I feel like I should go back through my old posts and replace every -96+ :x ) \$\endgroup\$
    – Dada
    Apr 19, 2017 at 5:19
  • \$\begingroup\$ The question specifies arrays are allowed as input. This can thus be briefer as a subroutine: {$@+=31&ord for@_;$@==100} (untested) \$\endgroup\$
    – msh210
    Apr 19, 2017 at 6:17
  • \$\begingroup\$ I guess it depends on context - here you're using it in a +=, but in other cases you might waste the saving on parentheses. \$\endgroup\$
    – Neil
    Apr 19, 2017 at 7:44
  • \$\begingroup\$ @msh210 The challenge says your one language's text datatypes. Arrays are hardly Perl's text datatype... (Otherwise it would have saved 1 byte indeed) \$\endgroup\$
    – Dada
    Apr 19, 2017 at 7:50

PowerShell, 36 30 bytes


Try it online!

Inputs as an array, but I'm wondering if there is a better way to handle characters.

EDIT Missed an easy space but @AdmBorkBork kindly let me know :P also, there was in fact a better way to handle the characters!

  • \$\begingroup\$ Hiya - a couple quick golfs. You don't need the parens around [char]$_-96, and you don't need the space between -eq and 100, getting you down to 33. You can also do "$_"[0] instead of [char]$_, getting you down to 32. Try it online! \$\endgroup\$ Apr 19, 2017 at 13:01
  • \$\begingroup\$ Are the " around $_ necessary? It appears to work without the cast. Could it be due to the input being a string array already? \$\endgroup\$
    – Sinusoid
    Apr 19, 2017 at 13:32
  • \$\begingroup\$ Ah, indeed you are correct. The " aren't needed in this particular instance. \$\endgroup\$ Apr 19, 2017 at 13:34

Alice, 28 18 bytes

Thanks to @MartinEnder for golfing 10 bytes


Try it online!

This submission uses a different method than @MartinEnder's answer.

This submission outputs 0x00 for falsy and 0x01 for truthy.

So here is a version that outputs 0 or 1 instead: Try it!


The explanation below is for the "visible" version. Both are very similar, except in the first program, the last o doesn't convert the 0 or 1 into a string (because we are in cardinal mode), but instead takes the number and output the character at that code point.

=                 Does nothing, but will be useful later on
I                 Read a character and push its code point onto the stack
                  If there is no more input, -1 is pushed instead
.                 Duplicate it
!                 Store it on the tape
#                 Skip the next command
o                 Gets skipped
'`                Push 96
-                 Subtract it from the character
+                 And add it to the total
?                 Load the number on the tape
h                 Increment it
n                 And negate it
                  For all characters that are read, ?hn results in 0,
                  but if -1 is pushed, then the result becomes 1

After this the IP wraps around to the left edge at the =. If the top value of the stack is 0, the IP continues on with its path, increasing the total sum of all the characters, once it is done with the input (the top of the stack will be 1), then the IP turns right (90 degrees clockwise).

One thing is important to note, the loop on the first line will iterate once after the input has ended. This will subtract 97 (96 from the '` and -1 from the lack of input) from the total.

>                Set the direction of the IP to East
3-               Subtract 3 from it (yields 0 if sum is 100, something else otherwise)
n                Negate it; Zero becomes 1, non-zero numbers become 0
/                Mirror; the IP gets redirected South-East
                 The IP reflects off the bottom and goes North-East
                 Now the program is in Ordinal mode, where numbers are automatically converted into strings when being used
o                Output the top of the stack as a string
                 IP reflects off the top and heads South-East
@                End the program

Taxi, 1259 bytes

Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Auctioneer School.Go to Auctioneer School:s 1 r 1 l 1 l.Pickup a passenger going to Chop Suey.0 is waiting at Starchild Numerology.Go to Starchild Numerology:s 1 l.Pickup a passenger going to Addition Alley.Go to Chop Suey:e 1 l 2 r 3 r 3 r.[a]Switch to plan "b" if no one is waiting.Pickup a passenger going to Charboil Grill.Go to Charboil Grill:n 1 l 3 l 3 l.Pickup a passenger going to What's The Difference.Go to Go More:e.64 is waiting at Starchild Numerology.Go to Starchild Numerology:e 2 r.Pickup a passenger going to What's The Difference.Go to What's The Difference:e 1 l 2 r 1 l.Pickup a passenger going to Addition Alley.Go to Addition Alley:e 2 r.Pickup a passenger going to Addition Alley.Go to Chop Suey:n 1 r 2 r.Switch to plan "a".[b]Go to Addition Alley:n 1 l 2 l.Pickup a passenger going to Equal's Corner.100 is waiting at Starchild Numerology.Go to Starchild Numerology:n 1 l 1 l 3 l 2 r.Pickup a passenger going to Equal's Corner.Go to Equal's Corner:w 1 l.Switch to plan "c" if no one is waiting."TRUE" is waiting at Writer's Depot.[c]"FALSE" is waiting at Writer's Depot.Go to Writer's Depot:n 1 l 1 r.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.

With line breaks, it looks like this:

Go to Post Office:w 1 l 1 r 1 l.
Pickup a passenger going to Auctioneer School.
Go to Auctioneer School:s 1 r 1 l 1 l.
Pickup a passenger going to Chop Suey.
0 is waiting at Starchild Numerology.
Go to Starchild Numerology:s 1 l.
Pickup a passenger going to Addition Alley.
Go to Chop Suey:e 1 l 2 r 3 r 3 r.
Switch to plan "b" if no one is waiting.
Pickup a passenger going to Charboil Grill.
Go to Charboil Grill:n 1 l 3 l 3 l.
Pickup a passenger going to What's The Difference.
Go to Go More:e.
64 is waiting at Starchild Numerology.
Go to Starchild Numerology:e 2 r.
Pickup a passenger going to What's The Difference.
Go to What's The Difference:e 1 l 2 r 1 l.
Pickup a passenger going to Addition Alley.
Go to Addition Alley:e 2 r.
Pickup a passenger going to Addition Alley.
Go to Chop Suey:n 1 r 2 r.
Switch to plan "a".
Go to Addition Alley:n 1 l 2 l.
Pickup a passenger going to Equal's Corner.
100 is waiting at Starchild Numerology.
Go to Starchild Numerology:n 1 l 1 l 3 l 2 r.
Pickup a passenger going to Equal's Corner.
Go to Equal's Corner:w 1 l.
Switch to plan "c" if no one is waiting.
TRUE is waiting at Writer's Depot.
FALSE is waiting at Writer's Depot.
Go to Writer's Depot:n 1 l 1 r.
Pickup a passenger going to Post Office.
Go to Post Office:n 1 r 2 r 1 l.

It accepts upper or lowercase because the Auctioneer School converts it all to uppercase.
Chop Suey breaks it into individual characters.
Charboil Grill converts characters to their ASCII code.
We pickup one character a time, convert it to ASCII, subtract 65, and add it to the running total.
Once there aren't any more characters, compare the total to 100.

Returns TRUE for dollar words and FALSE for everything else.

  • 1
    \$\begingroup\$ In a world of "boring" unreadable code-golf langages <20bytes answers, I welcome thy entry, kind stranger. \$\endgroup\$ Apr 21, 2017 at 11:00

IA-32 machine code, 21 bytes


33 c0 6a 64 5a 8a 01 41 24 1f 75 05 83 ea 01 d6
c3 2b d0 eb f0

Assembly code:

    xor eax, eax;   initialize eax to 0
    push 100;       initialize edx
    pop edx;            to 100
    mov al, [ecx];  load a byte
    inc ecx;        go to next byte
    and al, 31;     convert from letter to number
    jnz cont;       not done? continue

    ;               done:
    sub edx, 1;     check whether edx got to 0; result is in CF
    __emit(0xd6);   aka SALC - set al to CF
    sub edx, eax
    jmp myloop

Counts from 100 to 0. If arrived to 0, returns true (0xff); otherwise false (0x00).


Dyalog APL, 17 15 bytes


Uses the Dyalog Classic character set.

              ⍞  ⍝ string input
          ⎕AV⍳   ⍝ index in the character map
      17-⍨       ⍝ subtract 17 from each ('a' = 18)
    +/           ⍝ sum
100=             ⍝ equal to 100?
  • \$\begingroup\$ By default all submission must be full programs or functions. REPL programs are allowed as long as they're identified as such. However, you still have to request user input. \$\endgroup\$
    – Dennis
    Apr 19, 2017 at 7:04

Python, 38 bytes

lambda s:sum(map(ord,s))==4-96*~len(s)

Try it online!

Same length as ovs's solution. Rather than subtracting 96 from each ord value, this checks if the ord total equals 100+96*len(s). This is expressed one byte shorter as 4-96*~len(s), which equals 4-96*(-len(s)-1).

  • \$\begingroup\$ In Python 3, lambda s:sum(s.encode(),96*~len(s))==4 would also work. \$\endgroup\$
    – Dennis
    Apr 18, 2017 at 23:05

Ruby, 35 30 bytes


Try it online!


Retina, 47 23 bytes


Try it online! Note: Header lowercases input and splits it into words; results appear on separate lines. Edit: Saved far too many bytes thanks to @MartinEnder.

  • \$\begingroup\$ It's a lot shorter to compute the letter values by gradually lowering them while inserting characters: tio.run/nexus/… \$\endgroup\$ Apr 19, 2017 at 9:27

Octave, 18 bytes


Subtracts 96 from the input string x (lower case), to get the numeric values of the letters. Takes the sum and compares it to 100. Returns a logical 1 for truthy cases, and a logical 0 for false cases.

I could save one byte if it was OK to give false for "dollar words" and true for "non-dollar words".


///, 564 210 189 185 bytes


Try it online!

Prints a 1 if it is a "dollar word", otherwise prints a "0"

Input is the following: (Scroll all the way to the right)

/~/1\/\///4/11~3/41//6/33//2/66//5/22~a/~b/1~c/4~d/3~e/31~f/34~g/6~h/16~i/46~j/36~k/316~l/346~m/2~n/12~o/42~p/32~q/312~r/342~s/62~t/162~u/462~v/362~w/3162~x/3462~y/22~z/122~5555/0//INPUT WORD HERE/1/0

Works by replacing each letter with its value in unary, then replacing a unary 100 with a 0. It then substitutes whatever the word's value is with a 1. If the word's value is 0, then it will print a 1 because at the end of the code, it is replacing a 0. If the word's value is anything else, it will just print that 0.

The golf works by using common occurrences in the code as replacements.


Japt, 13 12 10 bytes

L¥U¬x_c %H


L¥ U¬x _c %H
L¥(U¬x(_c %H))
L¥(          )   // 100==
   U¬            //   Input split into a char array
     x(     )    //   The sum of:
       _         //     At each char:
        c        //       Get the char-code and
          %H     //       Mod 32

Test it online!


L¥U¬mc m%H x

Try it online!

Another 12-byte solution using a different technique

L¥U¬x@;CaX Ä

Try it online!

  • \$\begingroup\$ Great job! I think you can save a byte on the first one with m%H instead of m-96 (it'll work on both cases now, bonus!), and one on the second with L¥U¬x@;CaX Ä \$\endgroup\$ Apr 19, 2017 at 13:18
  • \$\begingroup\$ @ETHproductions Thanks! m%H was a nice find. x@ was a great idea too! \$\endgroup\$
    – Oliver
    Apr 19, 2017 at 15:39
  • \$\begingroup\$ @ETHproductions Got it down to 10 bytes ;) \$\endgroup\$
    – Oliver
    Apr 19, 2017 at 18:10

Ruby (2.4+), 38 bytes

Takes input in lowercase. Requires Ruby 2.4's Array#sum so it won't run on TIO.

  • 2
    \$\begingroup\$ Use String#bytes instead of String#chars so you don't have to call c.ord. \$\endgroup\$
    – Value Ink
    Apr 19, 2017 at 2:44
  • \$\begingroup\$ And use sum on the array instead of map \$\endgroup\$
    – G B
    Apr 19, 2017 at 6:07

Bash + GNU utils, 47

od -An -td1 -vw1|sed 's/^/a+=-96+/;$a!a-100'|bc

Try it online.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.