[Question]
      [
### Your task
Given a string, output the range of ASCII values.
### Example
Let's say we have the string `Hello`.
We get the ASCII values:
* `H` = 72
* `e` = 101
* `l` = 108
* `l` = 108
* `o` = 111
Now, we get the range (`max - min`):
* 111 - 72 = 39
Our answer is 39.
### Test cases
```
Input           Output
Hello, World!   82
aaaaa           0
Code Golf       79
Stack Exchange  88
ASCII           18
```
### Scoring
For scoring, we will get the range of ASCII/Unicode values of your program source code, and add that to the length of your code in bytes.
For example, with the program `abc`, the score would be:
* 3 (the length of the program) + 2 (the ASCII range of the program) = 5
You can use [this TIO link](https://tio.run/##RYyxCoMwFEX3fMXbTKh16SZ0KJ2Ebu3S8dVEDSR54SUF/XobKeh2OefeG5c8Ubisq/WROENakmC4gkP/0QiuBY@zdArO4G0oQdBhUwvOpiw9Rkmsa0hKieHwcwssSc6F2kLLd5OytqFhg1oqgQUO0irhto0JW4xsQ5bV7XnvOmAMo2mrGnAXDxPGPG3M7exFGR2knvhfPjm1rm/6MvSkDYxkEkyGzQ8) to get your score.
### Clarifications
* There will be no non-ASCII characters in the input (but your program source code may contain non-ASCII characters)
* There will be no newline characters in the input (but your program source code may include newlines)
* **Lowest score wins**

[Answer]
# [MATL](https://github.com/lmendo/MATL), score 37 (length 7, range 30)
```
X>GX<ZP
```
[Try it online!](https://tio.run/##y00syfn/P8LOPcImKuD/f3WP1JycfHUA "MATL – Try It Online") Or [verify](https://tio.run/##y00syfmf8D/Czj3CJirgv0tURch/dY/UnJx8HYXw/KKcFEV1LvVEEADSzvkpqQru@TlpQHZwSWJytoJrRXJGYl56KlDAMdjZ0xNIQ41SBwA) all test cases and source code.
```
X>    % Implicit input. Maximum
G     % Push input again
X<    % Minimum
ZP    % Distance (of code points). Implicit display
```
[Answer]
# [C (clang)](http://clang.llvm.org/), 79 bytes + 28 = ~~145 138 129 112 111~~ 107
*-7 score thanks to [@Digital Trauma](https://codegolf.stackexchange.com/users/11259/digital-trauma)
~~-9~~ -10 score thanks to [@jdt](https://codegolf.stackexchange.com/users/41374/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!](https://tio.run/##jVBNT4QwED3TXzGSbAIFshyNXWiga3STve1hDysHLB9LrNAAuhrDXxdbRA/Egz29eTNvOu9xj4u0LscxcmOytTCzKd1gtoloFGB2g1kY01gjn2DHYXRrMVthSkM2D0eB7hPdIJgFsRfp7ljVPXpOq9p6barMRh/IUAzgPu/6UwIBKMLYm/e5EI0Lx6YV2ZXpTlyq34xZk@Vw14hirg99yp/g9o2f1dH5TEYHttv94F8bpqrXGBzAa9ib/zK1kMwWl4v@MrxUTtf4yBhcwFi68PhSnK79xIU27wlCRtG0YEkVg86DAJYEHEfaUyoX3nH5bimJEkubKIrpakKyVTEWlrkSHXghrLKH2tRj31/4iR4a0DB@8kKkZTd6fVuVbSrPCl6@AA "C (clang) – 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()
```
[Answer]
# [Bash](https://www.gnu.org/software/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!](https://tio.run/##nY2xDoIwFAD3fsWTYLrYgZmBEEKUxMHIYBwr7yHEpq9piTj03yv@gjfccsM9dJjSOs2GwJPGEpCF87NdRpD7ICHLr@3lfM8gJkZQtQW1FqAW3PSOgf0CysZAW7MgC1fmTkYcQFFVeeUSsqV0ImP4ADf2BndC/xANI8GRzSj6RQ8vaD/DpO2TRN03XSf@mYkv "Bash – Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 13 bytes + 39 = 52
```
a:A^aMXaADMNa
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJhOkFeYU1YYUFETU5hIiwiIiwiIiwiXCJIZWxsbywgV29ybGQhXCIiXQ==)
### 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.)
[Answer]
# [Alumin](https://github.com/ConorOBrien-Foxx/Alumin), ~~36~~ 19 bytes + ~~22~~ 20 = ~~58~~ 39
```
idiqdhhhwrvsruripkc
```
[Try it online!](https://tio.run/##S8wpzc3M@/8/MyWzMCUjI6O8qKy4qLQosyA7GasgAA "Alumin – 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
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), score 56 (length 6, range 50)
```
@range
```
[Try it online!](https://tio.run/##y08uSSxL/f/foSgxLz31f5qCrUJiXrE1V5qGukdqTk6@jkJ4flFOiqK6JkgoEQQgTOf8lFQF9/ycNAg3uCQxOVvBtSI5A2QORMwx2NnTE8KEGK@u@R8A "Octave – Try It Online")
[Answer]
# [Terse](https://gymhgy.github.io/TerseLang/), 7 bytes + 6769 = 6776
```
找没最手样找到
```
[Try it here](https://gymhgy.github.io/TerseLang/?code=wGm9voTAag&in=IuaJvuayoeacgOaJi-agt-aJvuWIsCI)
Could be worse.
```
找　　　　　　　　Char codes
　没　　　　　　　Maximum, after
　　最手　　　　　　Squaring and then square root (identity)
　　　　样　　　　Subtract
　　　　　找到　　Minimum
```
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), ~~9~~ 12 bytes + ~~56~~ ~~49~~ 38 = 50
```
;*;-;o;/;\;`<@@o;/_$;`$$
```
This corresponds to the [Nibbles](http://golfscript.com/nibbles/index.html) 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](https://i.stack.imgur.com/KOztR.png)](https://i.stack.imgur.com/KOztR.png)
[Answer]
# [Julia](https://julialang.org), 22 bytes + 80 = 102
```
+s=-(-(extrema(s)...))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700qzQnM3HBgqWlJWm6Ftu0i211NXQ1UitKilJzEzWKNfX09DQ1IZI3G6OVPFJzcvJ1FMLzi3JSFJV0lBUULIy4lBJBAMyDAwMuJef8lFQF9_ycNISMuSWXUnBJYnK2gmtFckZiXnoqxAwLLiXHYGdPTyVkIxQMLbhi9WrsCooy80py8h51zNCGOATmWgA)
[Answer]
# Java 8, score: 134 (54 bytes)
```
s->s.chars().max().orElse(0)-s.chars().min().orElse(0)
```
[**Try it online**](https://tio.run/##dVLBTuMwEL33KwafbKU1e0IrKlaCqLAcFlYExIFFq8FxGhfXruxpAaF@e7GT0q1WIpEmmTfjN@@NPMMVjmb180ZZjBF@oXHvAwDjSIcGlYarnHYAKF5RMG4KUYwTuB6kEAnJKLgCByebOPoRpWoxRC7kHF9T9GFio@bfxGivYtx@ZTPORIvlk01EW76VNzXMk5jtyIdHFNQG/xJh8qr0gox3vbDGB77CAKQjlRj1sdMv8Hnonf3U1voh3Ptg6wM2ZJif9C19reHC2yb9V4TqOfO26KY6AadVeXnJ1qIbAFC9RdJz6ZckF4mXrOOf0wp2DKxwUu0QITo7AFmUylNO4J8kPkv7ls542Rir5XkKUQaN9am1Z2@J47@G30it9A1n8lBmMpmMMyGGsGvrlqpJJhOuxlCXfR7l3e353@9CxoU1xNkfx8TD0eN48IWh3FDkCWK8Ux90XFrK@pO/vVq@C1a7KbWp1qnqMy6@pq/K65tJ3hXvWYv@iCgYcFZsMZbeHi@YYNtLtt58AA) (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.
* We could change the `x` to `\u0078`, but unfortunately the next highest codepoint then becomes `u` which isn't too much lower than `x`, so the +5 in byte-count is higher than the -3 in codepoint, giving a +2 in score instead of decrease: [Try it online](https://tio.run/##dVLBThsxEL3nK6Y@2drE5NQiIirRVaAcSiu2iAOgyvV6sw6OHdmTUITy7el4N4QIiV3J9rwZv/dm5Llaq9G8ftxqp1KCH8r6lwGA9Whio7SBqxx2AGheYbR@BklMCNwMaEmo0Gq4Ag@n2zT6mqRuVUxcyIW6X43HX47pGOLUJcPHYnSQtv4ws51ktuXqryO2Hek62BoW5Gine/egBLYxPCWY/tNmiTb43l0TIl@rCGgSliqZE2@e4PXSC/tunAtDuA3R1Z/YkKn80V6G2sBFcA2dK1T6MfO2ys8MAWdVeXnJNqITAKieE5qFDCuUS@JF5/mrWsFOgBVe6j0iRNcOQDals8opvFnicxq69DbIxjojz2lJMhpVnzn37Zk43hX8UtjK0HAmj2Qmk9Q4E2II@7JuqAYlNeFrFeuyj5O8@X3@51jItHQWObv3TNx9fpgMPmgoFxRZQUz27qNJK4fZP/V3kMsPwhk/w5Zynas@4uJj@qr8eT3Ns@I9a9FfEQUDzoodxujv8YIJtntpm@1/).
* Using a regular for-loop requires both `{}` and a space, so the difference of the max-min codepoints would widen on both ends. And in addition it's longer anyway: [Try it online](https://tio.run/##dVLBjtMwEL33KwafbKU1nBBtNotKtAt7yIIIKw6lQsZxmnQdu7KnXaqq317spFsE0iaS7Xl6897M2GuxE5N19XiSWngPhWjNYQTQGlSuFlLBfQx7ACSVjXCLpWdpwI6jsHgU2Eq4BwPZyU@uD5HXZdPpdFxkb9LaOtpnzjw7dJm86t7LWZcWmbwuwqlIj07h1hkoJl16PKVRcrP9pYPkWXln2wq6UBUt0bVmtVgKho2zTx5ufku1wdaaocLotRMOUHnMhVczo57gOelAPimt7Ri@W6erV2RMRPzCnttKwUer63AuUcjHqNsIs1IBmJf53R05st4AoNx7VB23W@SboIva0Ge3hMyAJIbLC8LR5mFcc@fEnjLG@uYAYokyembwt0C6DtfATWt53WrFb8PiuVOimmv9YR8U/yN8EdhwW1PCX/MoxsMYCGNjuNDiTXmFPLRkKuGqfIg9f/h2@/Md436jW6TkhyFs8XaZjl5oLxKS6MDSS/VO@a3GWH/odnD/p9P08mC0MitsArNnDRFlL5uV@eevN3GOdPBIhhSWEKAkOWMk/AOeEEbOT/F4@gM).
**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
```
[Answer]
# [Excel](https://www.microsoft.com/en-us/microsoft-365/excel), score = ~~103~~ 94 (length 46, range 48)
-9 score thanks to [Engineer Toast](https://codegolf.stackexchange.com/users/38183/engineer-toast)
```
=LET(A,CODE(RIGHT(A1,ROW(A:A))),MAX(A)-MIN(A))
```
[![enter image description here](https://i.stack.imgur.com/SzCp3.png)](https://i.stack.imgur.com/SzCp3.png)
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~12 bytes + 86 = 98~~ 13 bytes + 56 = 69
h/t @isaacg
```
+/1_-':@/1<:\
```
[Try it online!](https://ngn.codeberg.page/k#eJxLs9LWN4zXVbdy0De0sYrh4srPSbHS1deo0bdW09d0iLHi4gqx0lDySM3JyVcIzy/KSVFU4lJQUFBKBAIIyzk/JVXBPT8nDcINLklMzlZwrUjOSMxLT4WIOQY7e3pCmEhmx1hBhFBcEKOkycWVph7CBQBShCQG)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 3 bytes + 32 = 35
```
Sds
```
### Explanation
```
Sds
S     % Sort implicit input
 d    % Difference between adjacent elements
  s   % Sum the values
```
[Try it online!](https://tio.run/##y00syfn/Pzil@P9/dY/UnJx8HYXw/KKcFEV1AA "MATL – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) + 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!](https://tio.run/##y0rNyan8/9//8Dx/z@D///@rewAF8nUUwvOLclIU1QE "Jelly – 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
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 11 bytes + [63](https://tio.run/##RYy9CsIwGEX3PMW3NcHaxS2iUAShIDjUxfGz6U8gfyQZWl8@pgjtdjnn3uuWOFlzSklqZ32EsATi4QIK9UcgKA4aZ6oYHEFLkwOxuw0clAyRanTUelFCYIwMu585eGrpnKnMNH9XIQppKt@joIxghgOVjKh105s1Oi9NpEXd3poGPJqx50UJuIlHb8Y4rUxt7GUjKgid9f/yQbGU6vZ7tef7@6m7Hw) = 74
```
ASz>o;FYOmc
```
[Try it online!](https://tio.run/##yygtzv7/3zG4yi7f2i3SPzf5////Hqk5Ofk6CuH5RTkpigA "Husk – 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.
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 42 bytes + 80 = 122
```
s=>Math.max(...b=Buffer(s))-Math.min(...b)
```
[Try it online!](https://tio.run/##Xc/BbsIwDAbgO0/hRRwSAWHbhW5SkQChwWGnHnYlhKQthBiSDDFNffauHSBV8dH@7F/ei4vw0pWnMLK4U7VOa59OP0Uo@FFcKed8m86/tVaOesZGt0Fp/weslmg9GsUN5nSTSXTqHfq/FlLQPGAWXGlzyrhRNg9FBdufoDwMGnJuCe0iVjWtdncA52rDer3ubU3JShmDQ/hCZ3ZPBBiD8RiS15iJtgg86saeY7VoXoUPNJp01OQtZlkQ8gDLqyyEzRW5ZyYxm2WL9TrOfEnqPw "JavaScript (Node.js) – Try It Online")
[Answer]
# [Ly](https://github.com/LyricLy/Ly), 8 bytes + 70 = 78
```
ia0I-s>l
```
[Try it online!](https://tio.run/##y6n8/z8z0cBTt9gu5///4JLE5GwF14rkjMS89FQA "Ly – 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
```
[Answer]
# [Raku](https://www.raku.org/), 25 bytes
ASCII range: 88
Length: 25
Total score: 113
```
[-] @_.ords.minmax[*-1,0]
```
[Try it online!](https://tio.run/##K0gtyjH7X1yapJCmUP0/WjdWwSFeL78opVgvNzMvN7EiWkvXUMcg9n@ttUJBUWZeCVCZukdqTk6@jkJ4flFOiqL6fwA "Perl 6 – Try It Online")
[Answer]
# [J](http://jsoftware.com/), score 70 (16 bytes, range 54)
```
[:+/2-/\a.I.]\:]
```
[Try it online!](https://tio.run/##y/r/P03B1koh2kpb30hXPyZRz1MvNsYq9n9qcka@QpqCukdqTk6@jkJ4flFOiqL6fwA "J – Try It Online")
* `]` `\:` `]`: Pass the input (using the identity function [`]`](https://www.jsoftware.com/help/dictionary/d500.htm)) on both sides of [`\:`](https://www.jsoftware.com/help/dictionary/d431.htm) to sort it in descending order.
* `a.` `I.`: For each character of the sorted input, find its index in the ["alphabet"](https://www.jsoftware.com/help/dictionary/dadot.htm); at least on TIO's setup, this contains all of [ISO-8859-1](https://en.wikipedia.org/wiki/ISO-8859-1) in order, which includes ASCII. Thus, this produces the ASCII values of the characters, while keeping the highest used character lower than the straightforward method of `3` [`u:`](https://www.jsoftware.com/help/dictionary/duco.htm) would.
([`I.`](https://www.jsoftware.com/help/dictionary/dicapdot.htm) would also take the following index if a character is not found, but that never happens; it was chosen over [`i.`](https://www.jsoftware.com/help/dictionary/didot.htm) to reduce the highest used character.)
* `2-/\`: For each length-2 subarray (from the `2` and [`\`](https://www.jsoftware.com/help/dictionary/d430.htm)), subtract the second value from the first ([`-`](https://www.jsoftware.com/help/dictionary/d120.htm) [`/`](https://www.jsoftware.com/help/dictionary/d420.htm)).
* `[:` `+/`: Take the sum ([`+`](https://www.jsoftware.com/help/dictionary/d100.htm) [`/`](https://www.jsoftware.com/help/dictionary/d420.htm)) of the values, using [`[:`](https://www.jsoftware.com/help/dictionary/d502.htm) to do so monadically.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal) -v, 35 bytes, score 61
```
castminusordceilceil[q]ordminmin[q]
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z85sbgkNzOvtDi/KCU5NTMHhKMLY4E8oCgQAdnEKdItywEA "Charcoal – 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!](https://tio.run/##S85ILErOT8z5/z@gKDOvRCO4BEil@yYWaFTqKPhm5pUWa/gXpWTmJeZo@CZWZOaW5moUamrqKMAFM/NggkBg/f//o7Vt5zseNe5@1NL6qKfj3A4w3XVux3/dshwA "Charcoal – 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:
```
ＳαＩ⁻℅⌈α℅⌊α
```
[Try it online!](https://tio.run/##S85ILErOT8z5/98zr6C0JLikKDMvXSNR05orAMgq0XBOLC7R8M3MKy3W8C9KycxLzNHwTazIzC3NBSrS1FGAC2bmwQSBwPr//8NTDy883Hlo7aFmqcMLDzVLHl74X7csBwA "Charcoal – 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).
```
Ｓ           Input as a string
 α          Store in variable `a`
      α     Input string
     ⌈      Maximum
    ℅       Ordinal
   ⁻        Subtract
         α  Input string
        ⌊   Minimum
       ℅    Ordinal
  Ｉ         Cast to string
            Implicitly print
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 8 bytes + 34 = 42
```
+F.+CDCM
```
[Try it online!](https://tio.run/##K6gsyfj/X9tNT9vZxdn3/38lGFMJAA "Pyth – Try It Online")
* `CM`: Map to ASCII value
* `CD`: Sort (equivalent to `S`)
* `.+`: Deltas (Differences between consecutive elements, all nonegative because of sort)
* `+F`: Sum (equivalent to `s`)
Using `.+` is golfier than `h` and `e`, and also stays within the established ASCII value range.
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 12 bytes + 52 = 64
```
)**J>]\/<].-
```
[Try it online!](https://tio.run/##SyotykktLixN/V/9X1NLy8suNkbfJlZP939teM5/j9ScnHwuZGEA "Burlesque – Try It Online")
```
)**  # Map to char code
J    # Duplicate
>]   # Maximum
\/   # Swap
<]   # Minimum
.-   # Difference
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 98 score (18 bytes)
ASCII range: 80
Length: 18
```
s=>s.Max()-s.Min()
```
[Try it online!](https://tio.run/##ZY7LCsIwEEX3/Yoxq4Q@EJdqC1J8FCoIFVyHJG2DJZEmlYL47bUPoYizGc6Zy3CZ8ZmR3aFRbGtsLVXhgVQ2ghzCzoSRCc60xcTvt1SYdBvnKozF6CSqSiPygx7cdF3xxazpMDPGmgs46iqfVWYpu8O@ZSVVhZj9LouTZMAv/1cZj08tOYyJqXzf/dFY8nIAbrW0IpVK4NG5aI1chIIL5anILV4t/dEHqVCFLYmbTznSv313Hw "C# (Visual C# Interactive Compiler) – Try It Online")
* -27 score thanks to Kevin Cruijssen for the tip to use C# Interactive
---
# [C# (Visual C# Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 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!](https://tio.run/##jc1LCoMwEIDhfU8xdZWAegGrUKQPoULBhesQow1NE@rEYimePY3FvZ3NwPD9DMeII3cDSt1B9UYrHvFF6mcCXDFEuMIH0DIrObyMbKBkUhPqj4s9Dprv0PY@D0Fqm0ELKThMM4xLNhIa@T0nLtksSW40GiXiupdW@F@CtCQ4C6VMQOkfKoTa9KrZrmo2z6rKTSPgZFS7KivL@B0OI78x3YlVvq/yovipCSb3BQ "C# (Visual C# Compiler) – Try It Online")
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 6 bytes + 67 = score 73
```
C:G$g-
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiQzpHJGctIiwiIiwiXCJIZWxsbywgV29ybGQhXCJcblwiQzpHJGctXCJcblwiYVwiIl0=)
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 31 bytes + 85 = 116
```
ToCharacterCode@s//Max@#-Min@#&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n1icnJkZlJiXnhpdHB9cUpSZlx6rYGX7PyTfOSOxKDG5JLXIOT8l1aFYX983scJBWdc3M89BWQ1Zn5JHak5Ovo5CeH5RToqiUqy@fgDQmBIuZCWJIIBdCmS8gnt@Thp26eCSxORsBdeK5AwQH7sax2BnT0@41H8A)
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) `GB`, 2 + 24 = 26
```
G_
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPUdfJmZvb3Rlcj0maW5wdXQ9SGVsbG8mZmxhZ3M9R0I=)
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
```
[Answer]
# [Sequences](https://github.com/nayakrujul/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)
```
[Answer]
# [Python](https://www.python.org), 39 + 80 = 119
```
print(ord(max(s:=input()))-ord(min(s)))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=dY8xTgMxEEV7n2JwE1vZTUGFVtoCRQhSb5HarG1i4R1btoOSs6RJA1yDa-Q2zO6SdEz3x-9__zl9xWPZBTx_W2iBc_65L7Z-uCxiclhESFoM6iBy0zqM-yKklPW0dCgyiT_8h5yrXJKLQjI2e3nXh2QaXoE3KKysgC9JXCOtlFDDNYsUvbc3GJYg_iUl_eGGGFKBfMyM2ZDAOzTgcFxQEe2wYUAztabLvBpetWom7FZ0BMyH8pQ533G-3L8Y70MF25C8vmNqHLYO2sBz8JZ1RfXv8HTodwrfDHvs1pvNbP0F)
[Answer]
# [Ruby](https://www.ruby-lang.org/), 26 bytes + 80 = 106
-2 bytes thanks to [Steffan](https://codegolf.stackexchange.com/users/92689/steffan)
```
->s{y=s.bytes;y.max-y.min}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcsEiN9ulpSVpuha7dO2Kqytti_WSKktSi60r9XITK3SBZGZeLUTBlgIFt2glj9ScnHwdhfD8opwURaVYiNSCBRAaAA)
[Answer]
# [Haskell](https://www.haskell.org), 27 bytes + 84 = score 111
```
_?s=(maximum$s)-(minimum$s)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708I7E4OzUnZ8FN7dzEzDzbgqLMvBIFFQUNe00FA4VoQwNDHQUoYaGjYG4EZBgaxi4tLUnTtdgdb19sq5GbWJGZW5qrUqypq5GbmQdlQ1QsgFJQGgA)
]


[Question]
      [
# Challenge
The goal is to output `Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo`.
[Context](https://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffalo_buffalo_buffalo_Buffalo_buffalo). (Maybe another interesting challenge could be printing all of the [other examples](https://en.wikipedia.org/wiki/List_of_linguistic_example_sentences#Lexical_ambiguity)? This would probably use similar logic but involve either a function or just a for loop.)
# Rule(s)
1. You cannot output anything other than the string with correct casing and spacing. Trailing new lines are allowed, trailing spaces are not.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so fewest bytes win!

[Answer]
# [Ohm v2](https://github.com/nickbclifford/Ohm), 20 bytes
```
‥bB.¢`b}®:_”cåχíð”↔ù
```
[Try it online!](https://tio.run/##y8/INfr//1HD0iQnvUOLEpJqD62zin/UMDf58NLz7YfXHt4AZD9qm3J45///AA "Ohm v2 – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 39 bytes
```
print('uffalo '.join('BbBbbbBb ')[:-2])
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQ700LS0xJ19BXS8rPzNPQ90pySkpCYgV1DWjrXSNYjX//wcA "Python 3 – Try It Online")
## Potentially invalid, 35 bytes
```
print('uffalo '.join('BbBbbbBb\b'))
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69EQ700LS0xJ19BXS8rPzNPQ90pySkpCYhjktQ1Nf//BwA "Python 3 – Try It Online")
[Answer]
# [brainfuck](https://esolangs.org/wiki/Brainfuck), 370 bytes
```
>++++++++[>++++++++<-]<++++++++[>++++<-]>>++.--------[>++>++<<-]>+.>--------------..[>+>+>+<<<-]>-----.>++++++.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>++++++++[>>++++++++<<-]>>++.<.>>>>..<<.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.<<<<<.>>>.<.>>>>..<<.>---.+++.<<<<<.>>>>+.<<.>>>>..<<-.>---.+++.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v/fThsKouEsG91YG1RRoIgdkKGnCwUgUSCyAYlr69npogA9PaA0CNqA5SFiUMP1QNgGBPTsgADEBjP0gAxdsEHIKhCOQLgN5hSEPgxthA2mjgoy3fD/PwA)
Not exactly the most optimized answer and could probably be golfed much further. Makes lots of use of copying cells, as well as repeadedly performing the same print function near the end.
Original un-minified version (sadly uncommented) [can be found here](https://gist.github.com/TheThunderGuyS/1fc08e8de4354b912f476b20c2074a16).
[Answer]
# T-SQL, ~~45 51~~ 47 bytes
```
PRINT REPLACE('B0 B0 b0 B0',0,'uffalo buffalo')
```
`PRINT` is shorter than `SELECT`. Using a numeral in the `REPLACE` eliminates a set of quotes and saves 2 bytes.
**EDIT**: Fixed trailing space, at the cost of 6 bytes. Saved 4 by replacing a longer phrase, thanks @Giuseppe
[Answer]
# [PHP](https://php.net/), ~~47~~ 45 bytes
```
while($x<8)echo~_[!$x],BbBbbbBb[$x++],uffalo;
```
[Try it online!](https://tio.run/##K8go@G9jX5BRwMWVmpyRr6CupG79vzwjMydVQ6XCxkITJFgXH62oUhGr45TklJQExNEqFdrasTqlaWmJOfnW/xH6AA "PHP – Try It Online")
*-2 bytes thx to @manatwork!*
[Answer]
# [K (ngn/k)](https://bitbucket.org/ngn/k), ~~27~~ 25 bytes
-2 bytes thanks to ngn!
```
" "/"BbBbbbBb",\:"uffalo"
```
[Try it online!](https://tio.run/##y9bNS8/7/19JQUlfySnJKSkJiJV0YqyUStPSEnPylf7/BwA "K (ngn/k) – Try It Online")
# [J](http://jsoftware.com/), 30 bytes
```
echo}:,/'BbBbbbBb',"{'uffalo '
```
[Try it online!](https://tio.run/##y/r/PzU5I7/WSkdf3SnJKSkJiNV1lKrVS9PSEnPyFdT//wcA "J – Try It Online")
[Answer]
# [Java (JDK)](http://jdk.java.net/), 49 bytes
```
v->"B b B b b b B b".replaceAll("b|B","$0uffalo")
```
[Try it online!](https://tio.run/##ZY09C8IwEIb3/oojOLRSg7sfoIObk@AiDtfaSOo1CcmlIOpvr6m6ORwvL8/Dey32OGsvt0F3znqGNnUZWZNU0dSsrZHTRfYHA/sGuxHVhCHAHrWBRwbgYkW6hsDIKXqrL9Allh/Ya3M9nQH9NRQfFWD3e7E8Jq/8KmtQsBr62VpsoYLxqm8K6RtHWDcbolxUz60oxWQelUKyohgWn8XDPXDTSRtZurTGuZLoHN1zE4mKYpRe2Wt4Aw "Java (JDK) – Try It Online")
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 41 38 bytes
-3 bytes thanks to @mazzy
```
'BbBbbbBb'-replace'.',' $0uffalo'|% *m
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/X90pySkpCYjVdYtSC3ISk1PV9dR11BVUDErT0hJz8tVrVBW0cv//BwA "PowerShell – Try It Online")
[Answer]
# [QBasic](https://en.wikipedia.org/wiki/QBasic), 43 bytes
```
u$="uffalo buffalo
?"B"u$" B"u$" b"u$" B"u$
```
Abuses a couple tricks with the autoformatter (besides the standard `?` for `PRINT` shortcut): the missing double quote is added at the end of line 1, and semicolons are inferred in the print statement whenever a literal string is next to a variable. After expansion, the code becomes
```
b$ = "uffalo buffalo"
PRINT "B"; b$; " B"; b$; " b"; b$; " B"; b$
```
The semicolon trick, plus the fact that string variables need the `$` sigil, meant that approaches using more variables to build the string ended up longer.
[Answer]
# [Java (JDK)](http://jdk.java.net/), 49 bytes
```
v->"B b B b b b B b".replaceAll("\\w","$0uffalo")
```
[Try it online!](https://tio.run/##ZY09C8IwEIb3/oojOLSiwd0P0MHNSXBRh2ttJPWahORSEfG311TdHI6Xl@fhvQY7nDaXW69bZz1Dk7qMrEmqaCrW1sjxPPuDgX2N7YAqwhBgh9rAMwNwsSRdQWDkFJ3VF2gTy/fstbkez4D@GoqPCrD9vVgckjf5KitQsOy76UpsoIThym8K6WtHWNVrolycTncxEaNZVArJiqKffxb3j8B1K21k6dIak8mVROfokZtIVBSD9spe/Rs "Java (JDK) – Try It Online")
## Credits
* -14 bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)
* -1 byte thanks to [Jo King](https://codegolf.stackexchange.com/users/76162/jo-king)
[Answer]
# x86-16 machine code, IBM PC DOS, ~~35~~ ~~33~~ 32 bytes
```
00000000: b820 09b1 e7ba 1801 cd21 d0e9 7409 7303  . .......!..t.s.
00000010: 3044 19cd 29eb f1c3 4275 6666 616c 6f24  0D..)...Buffalo$
```
Listing:
```
B8 0920     MOV  AX, 0920H          ; AH = 9 DOS string function, AL = ' '
B1 E7       MOV  CL, 11100111b      ; magic buffalo number 11100111
BA 0118     MOV  DX, OFFSET BUF     ; 'Buffalo' pointer for display
        STAMPEDE:
CD 21       INT  21H                ; write our *uffalo to screen
D0 E9       SHR  CL, 1              ; LSB of magic buffalo number into CF
74 09       JZ   BYE_BUFFALO        ; loop until CL is 0
73 03       JNC  HI_BUFFALO         ; if LSB bit is a 0, don't change case
30 44 19    XOR  [SI+BUF-100H], AL  ; swap case on first letter
        HI_BUFFALO:
CD 29       INT  29H                ; if not last of the buffalo, display a space
EB F1       JMP  STAMPEDE           ; keep 'em coming
        BYE_BUFFALO:
C3          RET                     ; return to DOS
        BUF:
            DB   'Buffalo$'         ; the real Buffalo
```
[Try it online!](http://twt86.co/?c=uCAJsee6GwGL2lDNIVjQ6XQIcwIwB80p6/DDQnVmZmFsbyQ=)
**Explanation:**
Uses the byte `0xe7` (`1110 0111` binary) to determine if the case should be swapped. Each `[Bb]uffalo` corresponds to the next least significant bit of the byte where a `1` means to change the case and a `0` means don't change.
The case of the first character can be alternated by doing an `xor 0x20` on the ASCII value. Now `0x20` just happens to be the ASCII value for a space character, so we can put that in `al` and use for both the `xor` and to write the space character.
[![enter image description here](https://i.stack.imgur.com/5pmNr.png)](https://i.stack.imgur.com/5pmNr.png)
**Props:**
* -1 byte thx to @peter ferrie!
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), ~~190~~ 179 bytes
```
+++[>+++[>++++[>++>+++>+++>+++>+++>+++>+++>+++>+[<]>>>-]>->->+>->->-[<]<-]<-]>>>+++.>->.>+++.>+++.>--.>.>+++.>----.[<]>>[.>]<[<]>.>>[.>]<[<]+++[>>[.>]<[<]>-]>.>>[.>]<[-]<[<]>>[.>]
```
[Try it online!](https://tio.run/##dY5RCoAwDEMPVNITlFxk7EMFQQQ/BM9fuw6dP7IuvCRjdD6n7VivZXcXkcJHUhv832KVJCoRR1IRmaFNNPFII9MO3UH5Ypj8oiirNdLBucBo8CnRo3TuNw "brainfuck – Try It Online")
The ASCII codes are initialised using a similar method to my [Buffalo answer](https://codegolf.stackexchange.com/a/218330/92901), though here both `b` and the second `f` get their own cells. Printing the output requires fewer instructions in brainfuck compared with Buffalo because of a key difference in the way that loops are handled: brainfuck uses the currently active cell to decide whether a loop ends, whereas Buffalo refers back to the cell that was originally active when the loop was entered. Consequently, we can print runs of letters in successive cells with a simple `[.>]` loop in brainfuck, a construction that isn't possible in Buffalo.
[Answer]
# [Red](http://www.red-lang.org), 57 bytes
```
prin collect[foreach b"BbBbbbBb"[keep rejoin[b"uffalo"]]]
```
[Try it online!](https://tio.run/##DcPRCcAgDAXAVSSjOEJ/Qz6MPqmtGAnt/GkPztHiQGOJ7WOlanOiPtzNUeqZlLJm1T/xDezkuGwsVnp7L9NIRCI@ "Red – Try It Online")
## Alternative:
## [Red](http://www.red-lang.org), 60 bytes
```
parse s:"B b B b b b B b"[any["b"insert"uffallo"|" "]]prin s
```
[Try it online!](https://tio.run/##K0pN@R@UmhId@78gsag4VaHYSslJIUkBhJMgtFJ0Yl5ltFKSUmZecWpRiVJpWlpiTk6@Uo2SglJsbEFRZp5C8f//AA "Red – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 16 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
Æ▼.#t!♦ΩÿN+╪\7êI
```
[Run and debug it](https://staxlang.xyz/#p=921f2e23742104ea984e2bd85c378849&i=)
Uses mixed base conversion and some zipping.
Made with a lot of @recursive's help.
[Answer]
# [C++11](https://gcc.gnu.org/), 126 bytes
```
#include<random>
#include<cstdio>
int main(){std::knuth_b g(7);for(char i{},s[]=" buffalo";i-8;++i)s[1]^=*s&g(),printf(s+!i);}
```
[Try it online!](https://tio.run/##Pcy7DoIwFADQna@omJjWwuCkocKPEDTl1sKN0DZ9TIRvr0yuZzjgXD0B5HxGA0tSn6eXRtm1K/4AISq0XYEmklWioWw7pGm@JsX5PZKJ3pnQ1lOYpSe47VXoh7YkY9JaLrYUWD8E58hCfxte7TVcJsoq549P08BPyMSe8w8 "C++ (gcc) – Try It Online")
Not a serious contender for shortest program — but I was inspired by the (original, now-deleted) requirement not to use a random number generator. ;)
[Answer]
# [Python 3](https://docs.python.org/3/), 117 bytes
```
o=['buffalo']
for x in ['B' if int(i) else 'b' for i in bin(69)[:1:-1]]:
  o.insert(0,x+o[-1][1:])
print(' '.join(o))
```
[Try it online!](https://tio.run/##FYxBCsMgEEX3nmJ2o7QNlUKhQja5xuCigtIpwQnGQHp6q7vH5/23/epH8qM1mQnDkdJ7FfQqSYETOAPhgsCpY9VsIK57BAwIQ@AhBM76@TLkrLtZ750CkInzHkvV9@t5EeozWeeN2sqoIOD0lf4SY1r7Aw "Python 3 – Try It Online")
69 is the reverse of the binary representation of the capitalization pattern.
[Answer]
# [Perl 5](https://www.perl.org/), 37 bytes
```
say"@{[map{(21%$_?b:B).uffalo}1..8]}"
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVLJoTo6N7GgWsPIUFUl3j7JyklTrzQtLTEnv9ZQT88itlbp//9/@QUlmfl5xf91fU31DAwNAA "Perl 5 – Try It Online")
[Answer]
# [Bubblegum](https://esolangs.org/wiki/Bubblegum), 17
Obligatory bubblegum answer generated with `zopfli --deflate --i1000 -c buffalo.txt | xxd`
```
00000000: 732a 4d4b 4bcc c957 4882 d2e8 fc24 fcf2  s*MKK..WH....$..
00000010: 00                                       .
```
[Try it online!](https://tio.run/##SypNSspJTS/N/f/fAAqsFMyNjRIVTFJMkhRMkpKTFZItTc0VTCwsjBRSjFItFNKSjUyARJqRgkKxlq@3t55euIceEKjo6XFBTDAEmmFgoEAc0Pv/HwA "Bubblegum – Try It Online")
[Answer]
# [Raku](https://github.com/nxadm/rakudo-pkg), ~~33~~ 30 bytes
```
put "BbBbbbBb".comb X~"uffalo"
```
[Try it online!](https://tio.run/##K0gtyjH7/7@gtERBySnJKSkJiJX0kvNzkxQi6pRK09ISc/KV/v8HAA "Perl 6 – Try It Online")
[Answer]
# [Rattle](https://github.com/DRH001/Rattle), ~~51~~ ~~46~~ 42 bytes
Rattle just hit release today - this is my first golf with the released version! If you're interested in learning a fun and easy new language, I would highly recommend checking it out!
```
B&b&uffalo& |I=[b0[2b^b1]b2b3b1b2[3q]b3+]4
```
[Try it online!](https://tio.run/##7T1te9s2kt/1KxDqEou2JIty0qRqHCdNk2fzPHttnyS7@0FRWkqEJG4oUuFLHPd8@eu9GbyQAAhSUpxcb3vrNrJFAANgZjBvGIDbq3ydxGe/d8ngeEAWSRDGqwkp8uXgAT7pOI7TeZpSP6cBSWLyel2QJ8WKeGdk9GBy98Hk7D4Zj8ajTuexXwCkdEJ@8OOQRp3HH2iahUk8Id5wNDzrdP62DRgUqO4NRuPB6AEZjyejEXn26jXrBn7wV56QIJl0CPywj4DOocNlES9yAHeLVCXVx8Z/R4lfViIAA4aTbPw8XPhRdEWyPEmhRkz8NPWvSBiTDd0k6RU8Csgm@UBJvqZkm4RxTlNsjl9j@jEnH/yooFUnNMooQIOZbGicZxckSaHgak7JP4ssJ3GSa6UPBwNyuQ4Xa7LAzhc58TMTBukxyGFOikyMcbWM/NWFK9CCn@@LcPGObNNklfqbTEHP8/C33@58X/z22/WtF9PVyUtvnt0@m47mo/nb0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1mfiRKxyNA6fi9tqMEDHXijK43WIKszlZTVsUla8JBRkrL9B640rq9xI@ZXne02Lu1x13ZXcnWDX9GBrdcxsWPxFk0qMkQUK8d2GumzsdJQXc3Tw7q2n/P1FjuO8@V17C@qL8@l8NB3P38692Xw8P8P3nk7P3s/mZyezu7@z924q7eWf0wmaHx3@nkL5EDT87/8D)
Try to out-golf me! You'll probably want to consult the [documentation](https://github.com/DRH001/Rattle)
## Explanation
```
B&b&uffalo&      creates an array of hard-coded strings: ["B","b","uffalo"," "]
    |            syntax for taking input
     I           stores this data in first memory slots
      =          sets top of stack to 0
       [ ... ]4  loops 4 times
    b0           adds item in slot 0 to buffer
      [2 ... ]   executes statements inside if top of stack is equal to 2
        b^       deletes last item from buffer
          b1     adds item in slot 1 to buffer
    b2b3b1b2     adds item in slot 2, 3, 1, 2 to buffer
    [3 ... ]     executes statement inside if top of stack is equal to 3
      q          ends program - buffer is implicitly printed
    b3           adds item in slot 3 to buffer
      +          adds 1 to top of stack
```
[Answer]
# [Regenerate](https://github.com/dloscutoff/Esolangs/tree/master/Regenerate), 27 bytes
```
B((uffalo) b$2 B$2 b$2) b$1
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72qKDU9NS-1KLEkdcGCpaUlaboWu500NErT0hJz8jUVklSMFJyAGEiDOIYQFVCFMA0A)
Pretty simple: golf repeated substrings using capture groups.
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf/blob/master/math_golf.txt), 18 [bytes](https://github.com/maxbergmark/mathgolf/blob/master/code_page.py)
```
9G*âx{ûbB§╕«Γ╢ô };
```
[Try it online.](https://tio.run/##ASgA1/9tYXRoZ29sZv//OUcqw6J4e8O7YkLCp@KVlcKrzpPilaLDtCB9O///)
`âx{ûbB§╕«Γ╢ô` could alternatively be `à{ENR**╦\i╛δ` for the same byte-count: [try it online](https://tio.run/##y00syUjPz0n7/9/SXevwgmpXvyAtrUdTl8VkPpo6@9wWhVrr//8B).
**Explanation:**
```
9G*               # Push 9*18=162
   â              # Convert it to a binary list
                  # (which is unfortunately in reversed order due to a bug)
    x             # Reverse it to the correct order
     {            # Loop over each of these bits as integers:
      ûbB         #  Push string "bB"
         §        #  (0-based) index the current bit into it
          ╕«Γ     #  Push compressed string "uffa"
             ╢ô   #  Push compressed string "lo"
                  #  Push a space character " "
     };           # After the loop: discard the final space
                  # (after which the entire stack is joined and output implicitly)
   à              # Convert it to a binary string (in correct order..)
    {             # Loop over each of these bits as characters:
     ENR**        #  Push 15*25*29=10875
          ╦       #  Get the dictionary word at this index: "buffalo"
           \      #  Swap so the current bit is at the top of the stack
            i     #  Convert it from a character to an integer
             ╛    #  If it's truthy:
              δ   #   Titlecase the string
```
[Answer]
# [Scratch](https://scratch.mit.edu), 8 blocks
[![hi if you’re reading this](https://i.stack.imgur.com/VmnFx.png)](https://i.stack.imgur.com/VmnFx.png)
[Try it on scratch!](https://scratch.mit.edu/projects/754657063/)
I tried to refrain from doing anything too illegal like setting the costume as `Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo` or setting a variable as that.
Here is the scratchblocks code (102 bytes):
```
when gf clicked
for each[i v]in(8){set[B v]to(join(B)(join(letter(i)of[BbBbbbBb])[uffalo ])
}::control
```
Usually when people submit scratch, they submit Tosh (<https://tosh.blob.codes/>), which is Scratch but text-based or an image of the blocks compiled on scratchblocks (<https://scratchblocks.github.io>). I would’ve done both, but the `for each [i v] in (8)` block is old and removed and I can’t figure out how to do it on Tosh.
[Answer]
# [sed](https://www.gnu.org/software/sed/), ~~35~~ 33 bytes
*-2 bytes thanks to [user41805](https://codegolf.stackexchange.com/users/41805/user41805)*
```
s/^/BbBbbbBb/
s/./ &uffalo/g
s///
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724ODVlwYKlpSVpuhY3lYr14_SdkpySkoBYn6tYX09fQa00LS0xJ18_HczVh6iEaliwkAvCAAA)
34B solution:
*-1 byte thanks to [user41805](https://codegolf.stackexchange.com/users/41805/user41805)*
```
s/^/B b B b b b B b/
s/\>/uffalo/g
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724ODVlwYKlpSVpuhY3lYr14_SdFJIUQDgJQutzFevH2OmXpqUl5uTrp0NUQjUsWMgFYQAA)
35B solution: *(The regex matches empty string at first and then is reused for the second `s` command)*
```
s/b*/B b B b b b B b/i
s//&uffalo/g
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724ODVlwYKlpSVpuhY3lYv1k7T0nRSSFEA4CULrZ3IV6-urlaalJebk66dDlEJ1LFjIBWEAAA)
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 48 bytes
```
##<>#&//"B"~Print~#["uffalo"~#~b~#~" B",b=" b"]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE7875@WFh1cUpSZl@6Vn5lnZVUMZsf@V1a2sVNW09dXclKqCwAKldQpRyuVpqUl5uQr1SnXJQGxkoKTkk6SrZJCklKs2v//AA "Wolfram Language (Mathematica) – Try It Online")
Port of TiKevin83's [TI-BASIC solution](https://codegolf.stackexchange.com/a/218303/81203).
[Answer]
# [Clojure](https://clojure.org), 60 bytes
```
(clojure.string/join " " (map #(str % "uffalo") "BbBbbbBb"))
```
[Answer]
## C#, 131 bytes
```
using System.Linq;using System;class A{static void Main(){Console.Write($"{String.Join("uffalo ", "BbBbbbBb".ToArray())}uffalo");}}
```
[Try it online!](https://dotnetfiddle.net/B4jteX)
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 22 bytes
```
jdm+d"uffalo""BbBbbbBb
```
[Try it online!](https://tio.run/##K6gsyfj/PyslVztFqTQtLTEnX0nJKckpKQmI//8HAA "Pyth – Try It Online")
[Answer]
# [jq](https://stedolan.github.io/jq/), 35 characters
```
"BbBbbbBb "/""|join("uffalo ")[:-2]
```
Sample run:
```
bash-5.0$ jq -nr '"BbBbbbBb "/""|join("uffalo ")[:-2]'
Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo
```
[Try it online!](https://tio.run/##TU@7CgIxEOz9iiE2CgbB0tJOCy0sxSJ3t2okt3uXbBTBbze@ECymmve5L0NEauVC0BPB2uiuVrJ2WVFL2zpubPBMkE69MFRwJMVqu1njKxsMMVqiJceTH/tOSho9H0FcB0nUwDMayVUg9FmU0gRJcJOMRJ/qSPAJLNDofHhbU@dqGhezqBZV9QLM1Jj7WTyPTD4cXBCY8W5uZ/tSHt95qVjLOQTr@bWs/L95Ag "jq – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 23 22 bytes
Save a byte thanks to @Scott!
```
V"BbBbbbBb"p+N"uffalo
```
[Try it online!](https://tio.run/##K6gsyfj/381PySnJKSkJiJUKtP2UStPSEnPyFf7/BwA "Pyth – Try It Online")
---
I wanted to be smart and encode the state of the upper- and lowercase letters as bits, but that ended up taking a byte more. Here's the code and explanation anyway!
### 24 bytes
```
FNj162 2p+?N\B\b"uffalo
```
```
FN                         # loop with N
  j162 2                   # convert 162 into binary as list of bits
        p                  # print without newlines
         +                 # concatinate strings
          ?N\B\b           # ternary operator, checks if the bit is falsey (0)
                "ufallo    # note the trailing space
```
]


[Question]
      [
# Challenge:
Read input (within visible ASCII range) and output with a few modifications:
1. In each set of 10 characters of the input randomly (50/50):
	* replace one character\* (with a random\*\* one within visible ASCII range) (ex. `lumberjack` becomes `lumbeZjack`)
	* or remove one character (ex. `lumberjack` becomes `lmberjack`)
\* If the set is of less than 10 characters, you don't have to modify it, but you can.
\*\* The character can be the same as the one input, as long as it's still random.
# Example:
Input: `Go home cat! You're drunk!`
Output: `Go hom cat! YouLre drunk!`
(just a example, since output could be random, don't use as a test case)
# Rules:
* [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), least characters wins!

[Answer]
# Pyth, ~~27~~ 25 bytes
```
VczTpXNOT?<JOr\ \ÞKC127JK
```
[Test suite available here.](http://pyth.herokuapp.com/?code=VczTpXNOT%3F%3CJOr%5C+%5C%C3%9EKC127JK&input=Go+home+cat%21+You%27re+drunk%21&test_suite=1&test_suite_input=lumberjack%0AGo+home+cat%21+You%27re+drunk%21%0APerhaps+I+should+not+use+test+cases+from+the+question%2C+as+the+output+can+be+different+from+those+examples+and+still+be+correct%21&debug=0)
Thanks to [Maltysen](https://codegolf.stackexchange.com/questions/103355/this-cat-has-bugs-really/103376#comment251583_103376) for shaving off 2 bytes.
# Explanation
```
VczTpXNOT?<JOr\ \ÞKC127JK    z autoinitalizes to input, T autoinitializes to 10
 czT                         chop input into strings of length 10, returned as list of strings
V                            for each string N in this list:
            Or\ \Þ            randomly pick a char between ' ' (32) and 'Þ' (222)
           J                  and assign it to variable J
                  KC127       assign the DEL char to variable K
         ?<J      K           if J < K:
     XNOT              J       replace a random character in N with J
         ?<J      K           else:
     XNOT               K      replace a random character in N with K
    p                         print this string with no trailing newline
```
As is often the case, I feel that this is a bit of a naive method and may be improved upon. Usually I find something obvious while typing up the explanation but nothing jumped out at me this time.
[Answer]
## [\*><>](https://esolangs.org/wiki/Starfish), ~~44~~ ~~46~~ ~~52~~ 50 bytes
```
rl5(?voooo/!|Ou+1Ox:@=?~o~oooo!
ol5(?v" ":/
o;!?l<
```
[Try it here!](https://starfish.000webhostapp.com/?script=E4GwrAFA-Abg9guB6AhAHwPIFcDUBGDADwC4ABAXigD84bEUAoOcaGAIgAI3ikmBuFFBAAeIA)
This uses any ascii character near/above space for the random characters. This always edits the 6th character, unless it's the end of a string and that string's length isn't a multiple of 10. This has a 50% chance to remove the 7th character instead of editing the 6th.
### Input
>
> The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a
>  technical standard for floating-point computation established in 1985
>  by the Institute of Electrical and Electronics Engineers (IEEE). The
>  standard addressed many problems found in the diverse floating point
>  implementations that made them difficult to use reliably and portably.
>  Many hardware floating point units now use the IEEE 754 standard.
>
>
>
### Output
>
> The IEE Standardfor Float$ng-Point Aithmetic (EEE 754) i a technicl
>  standar! for floa!ing-point!computati#n establised in 1985by the
>  Insitute of !lectrical#and Electrnics Engi!eers (IEE%). The st!ndard
>  add!essed man! problems#found in !he divers! floating oint
>  impl!mentation" that mad# them dif!icult to ue reliabl# and port!bly.
>  Many!hardware foating po#nt units %ow use th! IEEE 754"standard.
>
>
>
Edit: ~~This answer probably isn't always in the visible ascii range, editing...~~ Fixed.
Edit2: ~~Didn't see there needs to be a 50/50 chance to remove a character, editing again...~~ I believe everything is in order now :).
[Answer]
# [Perl 6](https://perl6.org), ~~78~~ 67 bytes
```
{[~] map {~S/.**{(^.chars).pick}<(./{(' '..'~').pick x Bool.pick}/},.comb(10)}
```
```
{[~] .comb(10)».&{~S/.**{10.rand}<(./{(' '..'~').pick x 2.rand}/}}
```
[Try it](https://tio.run/nexus/perl6#@19anKpQZqaXbM2VW6mglpyfkqpgq1AdXReroJecn5ukYWigeWi3nlp1XbC@npZWtaGBXlFiXkqtjYaefrWGuoK6np56nbqmXkFmcrZChYIRRFa/tparOLFSAWzc@72L3PMVMvJzUxWSE0sUFSLzS9WLUhVSikrzshXf712skJZfpBBnaPD/PwA "Perl 6 – TIO Nexus")
## Explanation:
```
{
  [~]                  # reduce with string concatenation operator
  .comb(10)\           # take input and break it into chunks of up-to 10 chars
  ».\                 # on each of them call the following
  &{
    ~                  # Stringify the following
    S/                 # substituted
      .                # any char
        **             # repeated
           { 10.rand } # a random number of times
      <(               # ignore all of that
      .                # the char to be removed/replaced
    /{
      ( ' ' .. '~' ).pick  # choose a character
      x                    # string repeated
      2.rand               # zero or one times
    }/
  }
}
```
[Answer]
# Pyth - 21 bytes
```
smO,XdOTOr;\~.DdOTcQT
```
[Try it online here](http://pyth.herokuapp.com/?code=smO%2CXdOTOr%3B%5C%7E.DdOTcQT&input=%22Go%20home%20cat%21%20You%27re%20drunk%21%22&debug=0).
[Answer]
# [Python 3](https://docs.python.org/3/), 75 bytes
The 75-byte applies the transformation to the first character of each group, and only picks from 2 random characters, such as in [the Jelly answer](https://codegolf.stackexchange.com/a/103394/60919) (which OP allowed):
```
from random import*
f=lambda s:s and choice(['','a','b'])+s[1:10]+f(s[10:])
```
[**Try it online!**](https://tio.run/nexus/python3#DYm7DoQgEAD7@4o9G0AttCW5@j6A0lCsPCK5gzUbLPx6pJjMJNMiUwbG4rtSPonr@IqfP@bdIxhtoC9wByUX5CbELLCzC6sms616XewUZa9FW9VOTqXKKIcvwUE5gMM6w02X4ACer/J7D0q1Bw)
This is a recursive function which, every iteration, prepends either nothing, `'a'`, or `'b'`, and then calls itself with the first 10 characters sliced off. The final iteration short circuits at `s and` (an empty string is falsy), avoiding infinite recursion.
The result of all the separate calls are then concatenated, and returned to the context which called the function.
# 120 bytes
Of course, that feels a bit like cheating, so here's one which is completely random:
```
from random import*;r=randint
def f(S):a=S[:10];R=r(0,len(a)-1);print(end=a[:R]+chr(r(32,126))*r(0,1)+a[R+1:]);f(S[10:])
```
[**Try it online!**](https://tio.run/nexus/python3#JYyxDoMgFEX3fgV16XtKE7FJBwhzdxyJAxGIphXMiw79eovpdE9uzr1HpLwwcsmXmJc101Yr0mcxp@3iQ2QRepRO91aKdlBGE7T8ExI4vAtUKxUPQvLaWWmGZpwICB4dF90TsT5lgY2zphFyQFXOrGgLHf9hhOqV2ZSXwEa3cfbN@40C87Sn97VCPH4)
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 13 bytes
```
₀ẇ⟑ẏ℅kP¤"℅℅Ȧ₴
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLigoDhuofin5Hhuo/ihIVrUMKkXCLihIXihIXIpuKCtCIsIiIsIlwiR28gaG9tZSBjYXQhIFlvdSdyZSBkcnVuayFcIiJd)
```
₀ẇ            # Chunks of length 10...
  ⟑           # Over each...
           Ȧ  # Replace at ...
   ẏ℅         # random index in the input
          ℅   # A random item of...
         ℅    # A random item of...
     kP       # Printable ascii
       ¤"     # Or the empty string
            ₴ #
```
[Answer]
**Clojure, ~~135~~ 139 bytes**
Edit: Forgot to use `partition-all` instead of `partition`.
```
(fn[i](apply str(flatten(map #(let[r rand-int [b e](split-at(r 9)%)][b(if(<(rand)0.5)""(char(+(r 25)97)))(rest e)])(partition-all 10 i)))))
```
Ungolfed:
```
(def f (fn[i]
         (->> i
              (partition-all 10)
              (map #(let [[begin end] (split-at (rand-int 9) %)]
                      [begin (if (< 0.5 (rand)) "" (char (+(rand-int 25)97))) (rest end)]))
              flatten
              (apply str))))
```
Man those function names are long... Anyway, it splits input into partitions of 10 characters, splits them at random point into two halves, randomly injects an empty string or a random character between them and discards the first character of the 2nd half.
[Answer]
## Mathematica 133 Bytes (129 characters)
```
StringReplacePart[#,Table[If[(r=RandomInteger)[]<1,"",FromCharacterCode@r@128],c=⌊StringLength@#/10⌋],Array[{g=10#-9+r@9,g}&,c]]&
```
76 characters to write the names of 8 functions :/
Using the `⌊..⌋` instead of `Floor[]` saves 5 characters, 1 byte.
[Answer]
# Python 3, 129 bytes
```
def f(s):f=id(s)%9+1;print(''.join(j[0:f-1]+chr(33+id(s)%94)*(id(s)//10%2)+j[f:]for j in [s[i:i+10]for i in range(0,len(s),10)]))
```
In order to save some bytes, instead of importing Python's random module, I just did some modulo operations on the id of the string, which should be different every time. For example the program will decide whether or not to remove a char or replace one based on whether or not `id(string)//10` is even (I integer divide by 10 as the last digit will always be even).
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~15 14~~ 13 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page) 13 characters
```
2X
s⁵µ¢1¦ṫ¢µ€
```
**[TryItOnline!](http://jelly.tryitonline.net/#code=MlgKc-KBtcK1wqIxwqbhuavCosK14oKs&input=&args=TG9yZW0gSXBzdW0uIFNlZCB1dCBwZXJzcGljaWF0aXMsIHVuZGUgb21uaXMgaXN0ZSBuYXR1cyBlcnJvciBzaXQgdm9sdXB0YXRlbSBhY2N1c2FudGl1bSBkb2xvcmVtcXVlIGxhdWRhbnRpdW0sIHRvdGFtIHJlbSBhcGVyaWFtIGVhcXVlIGlwc2EsIHF1YWUgYWIgaWxsbyBpbnZlbnRvcmUgdmVyaXRhdGlzIGV0IHF1YXNpIGFyY2hpdGVjdG8gYmVhdGFlIHZpdGFlIGRpY3RhIHN1bnQsIGV4cGxpY2Fiby4gTmVtbyBlbmltIGlwc2FtIHZvbHVwdGF0ZW0sIHF1aWEgdm9sdXB0YXMgc2l0LCBhc3Blcm5hdHVyIGF1dCBvZGl0IGF1dCBmdWdpdCwgc2VkIHF1aWEgY29uc2VxdXVudHVyIG1hZ25pIGRvbG9yZXMgZW9zLCBxdWkgcmF0aW9uZSB2b2x1cHRhdGVtIHNlcXVpIG5lc2NpdW50LCBuZXF1ZSBwb3JybyBxdWlzcXVhbSBlc3QsIHF1aSBkb2xvcmVtIGlwc3VtLCBxdWlhIGRvbG9yIHNpdCBhbWV0IGNvbnNlY3RldHVyIGFkaXBpc2NpW25nXSB2ZWxpdCwgc2VkIHF1aWEgbm9uIG51bXF1YW0gW2RvXSBlaXVzIG1vZGkgdGVtcG9yYSBpbmNpW2RpXWR1bnQsIHV0IGxhYm9yZSBldCBkb2xvcmUgbWFnbmFtIGFsaXF1YW0gcXVhZXJhdCB2b2x1cHRhdGVtLiBVdCBlbmltIGFkIG1pbmltYSB2ZW5pYW0sIHF1aXMgbm9zdHJ1bSBleGVyY2l0YXRpb25lbSB1bGxhbSBjb3Jwb3JpcyBzdXNjaXBpdCBsYWJvcmlvc2FtLCBuaXNpIHV0IGFsaXF1aWQgZXggZWEgY29tbW9kaSBjb25zZXF1YXR1cj8gUXVpcyBhdXRlbSB2ZWwgZXVtIGl1cmUgcmVwcmVoZW5kZXJpdCwgcXVpIGluIGVhIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlLCBxdWFtIG5paGlsIG1vbGVzdGlhZSBjb25zZXF1YXR1ciwgdmVsIGlsbHVtLCBxdWkgZG9sb3JlbSBldW0gZnVnaWF0LCBxdW8gdm9sdXB0YXMgbnVsbGEgcGFyaWF0dXIu)**
Replaces or removes the first of every ten characters including that of the last 1-9 if there is such a chunk. Chooses from the, admittedly small, subset of characters: `1`; `2`.
### How?
```
2X         - Link 1, flip a coin: no arguments
 X         - random choice from
2          - 2 (treated as the integers [1,2])
s⁵µ¢1¦ṫ¢µ€ - Main link: string of printable ASCII
s⁵         - split (s) into chunks of size ten (⁵)
  µ     µ  - monadic chain separation
         € - for each chunk
   ¢       -     last link as a nilad
    1¦     -     apply to index 1 (replace 1st of the 10 char chunk with the chosen integer)
       ¢   -     last link as a nilad
      ṫ    - tail - if it was 1 this has no effect (50%)
                  - if it was 2 this discards the replaced character (50%)
           - implicit print
```
---
To choose from all of printable ASCII rather than just `1` and `2` (still replacing or removing the 1st character of each chunk) in 21 bytes:
```
s⁵µ32r126¤ỌX¤1¦ṫ2X¤µ€
```
---
For a [fully random version](http://jelly.tryitonline.net/#code=OTVSKzMx4buMWDsKCnPigbXCteG5meKBtVjCpMKp4bmWMljCpMS_4bmZwq5DwqTCteKCrA&input=&args=TG9yZW0gSXBzdW0uIFNlZCB1dCBwZXJzcGljaWF0aXMsIHVuZGUgb21uaXMgaXN0ZSBuYXR1cyBlcnJvciBzaXQgdm9sdXB0YXRlbSBhY2N1c2FudGl1bSBkb2xvcmVtcXVlIGxhdWRhbnRpdW0sIHRvdGFtIHJlbSBhcGVyaWFtIGVhcXVlIGlwc2EsIHF1YWUgYWIgaWxsbyBpbnZlbnRvcmUgdmVyaXRhdGlzIGV0IHF1YXNpIGFyY2hpdGVjdG8gYmVhdGFlIHZpdGFlIGRpY3RhIHN1bnQsIGV4cGxpY2Fiby4gTmVtbyBlbmltIGlwc2FtIHZvbHVwdGF0ZW0sIHF1aWEgdm9sdXB0YXMgc2l0LCBhc3Blcm5hdHVyIGF1dCBvZGl0IGF1dCBmdWdpdCwgc2VkIHF1aWEgY29uc2VxdXVudHVyIG1hZ25pIGRvbG9yZXMgZW9zLCBxdWkgcmF0aW9uZSB2b2x1cHRhdGVtIHNlcXVpIG5lc2NpdW50LCBuZXF1ZSBwb3JybyBxdWlzcXVhbSBlc3QsIHF1aSBkb2xvcmVtIGlwc3VtLCBxdWlhIGRvbG9yIHNpdCBhbWV0IGNvbnNlY3RldHVyIGFkaXBpc2NpW25nXSB2ZWxpdCwgc2VkIHF1aWEgbm9uIG51bXF1YW0gW2RvXSBlaXVzIG1vZGkgdGVtcG9yYSBpbmNpW2RpXWR1bnQsIHV0IGxhYm9yZSBldCBkb2xvcmUgbWFnbmFtIGFsaXF1YW0gcXVhZXJhdCB2b2x1cHRhdGVtLiBVdCBlbmltIGFkIG1pbmltYSB2ZW5pYW0sIHF1aXMgbm9zdHJ1bSBleGVyY2l0YXRpb25lbSB1bGxhbSBjb3Jwb3JpcyBzdXNjaXBpdCBsYWJvcmlvc2FtLCBuaXNpIHV0IGFsaXF1aWQgZXggZWEgY29tbW9kaSBjb25zZXF1YXR1cj8gUXVpcyBhdXRlbSB2ZWwgZXVtIGl1cmUgcmVwcmVoZW5kZXJpdCwgcXVpIGluIGVhIHZvbHVwdGF0ZSB2ZWxpdCBlc3NlLCBxdWFtIG5paGlsIG1vbGVzdGlhZSBjb25zZXF1YXR1ciwgdmVsIGlsbHVtLCBxdWkgZG9sb3JlbSBldW0gZnVnaWF0LCBxdW8gdm9sdXB0YXMgbnVsbGEgcGFyaWF0dXIu) (50/50 remove/replace, uniform random printable ASCII, and a uniformly random character location within each chunk) I have 30 bytes (probably non-optimal):
```
95R+31ỌX;
s⁵µṙ⁵X¤©Ṗ2X¤Ŀṙ®C¤µ€
```
This rotates each chunk left by a random amount, pops the last character off and then calls a random one of the first two links, one of which is empty and the other which concatenates with a random printable ASCII character; it then rotates the chunk right again.
[Answer]
# Python3, ~~188~~ ~~186~~ ~~184~~ 114 characters
```
from random import*
s=input()
for c in[s[i:i+10]for i in range(0,len(s),10)]:print(end=choice(["","x","y"])+c[1:])
```
~~Seems too long. Could probably be shortened a lot with a lambda.~~
Apparently the OP has allowed choosing the random character from a list of two characters and the index of the character to be replaced can be a constant. After the modifications, my answer would've looked exactly the same as [@FlipTacks](https://codegolf.stackexchange.com/a/105194/41754) Python submission, so this is the form I'm staying with.
[@FlipTack](https://codegolf.stackexchange.com/users/60919/fliptack) saved 5 bytes!
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-pl`, 52 bytes
```
gsub(/.{10}/){_1[rand 0..9]=[*" "..?~,""].sample
_1}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcnm0km5BjlLsgqWlJWm6FjdN0otLkzT09aoNDWr1NavjDaOLEvNSFAz09CxjbaO1lBSU9PTs63SUlGL1ihNzC3JSueINayF6oUYs2OWer5CRn5uqkJxYoqgQmV-qXpSqkFJUmpetCFEBAA)
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 46 bytes
```
Fi(a<>t){IRR2YiRARR#iRCPAEL{YiRARR#ix}b:bAEy}b
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJGaShhPD50KXtJUlIyWWlSQVJSI2lSQ1BBRUx7WWlSQVJSI2l4fWI6YkFFeX1iIiwiIiwiIiwiXCJHbyBob21lIGNhdCEgWW91J3JlIGRydW5rIVwiIl0=)
How?
```
Fi(a<>t){IRR2YiRARR#iRCPAEL{YiRARR#ix}b:bAEy}b
Fi      {                                   }  - For each in
      t                                        - Var for 10
   a<>t                                        - Split input into 10 pieces
         I                                     - If truthy
          RR2                                  - 0 or 1
             Y                                   - Yank (equivalent to (y:a)):
               RA                                 - Replace item in at index
              i                                   - First input
                 RR#i                             - Random int from 0 to length of input
                     RCPA                         - Random Printable ASCII character
                         EL{         }         - Else
                            Y                    - Yank:
                              RA                  - Replace item in at index
                             i                    - First input
                                RR#i              - Random int from 0 to length of input
                                    x             - Empty string
                                      b:       - Assign b to
                                        bAEy   - Append y to b
                                             b - Output b
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 13 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
TôεžQΩæΩ9ÝΩǝ?
```
Also (potentially) modifies the last part if it's less than 10 characters.
[Try it online](https://tio.run/##AUQAu/9vc2FiaWX//1TDtM61xb5RzqnDps6pOcOdzqnHnT///0dvIGhvbWUgY2F0ISBZb3UncmUgZHJ1bmsh/y0tbm8tbGF6eQ) or [see 10 example outputs at once](https://tio.run/##AUsAtP9vc2FiaWX/VEb/VMO0zrXFvlHOqcOmzqk5w53OqcedP/99XMK2P/9HbyBob21lIGNhdCEgWW91J3JlIGRydW5rIf8tLW5vLWxhenk).
**Explanation:**
```
Tô             # Split the (implicit) input-string into parts of size 10
               # (where the trailing part is potentially smaller)
  ε            # Foreach over the parts:
   žQ          #  Push the printable ASCII string constant
     Ω         #  Pop and push a random character from it
      æ        #  Get the powerset of this character, resulting in a pair of an empty
               #  string "" and the character
       Ω       #  Pop and push a random item from this pair
        9Ý     #  Push list [0,1,2,3,4,5,6,7,8,9]
          Ω    #  Pop and push a random digit from this list
           ǝ   #  Replace the character at that (0-based) index with the chosen ASCII
               #  character or the empty string
               #  (if the index is ≥ the length, it does nothing)
            ?  #  Pop and print the modified part
```
]


[Question]
      [
### Your task
Given a string of lowercase letters, output the "alphabet checksum" of that string, as a letter.
### Example
Let's say we have the string *"helloworld"*. With `a = 0`, `b = 1`, `c = 2` ... `z = 25`, we can replace all of the letters with numbers:
```
h  e  l  l  o  w  o  r  l  d
7  4  11 11 14 22 14 17 11 3
```
Now, we can sum these:
```
7+4+11+11+14+22+14+17+11+3 = 114
```
If we mod this by 26, we get:
```
114 % 26 = 10
```
Now, using the same numbering system as before, get the 10th letter, `k`. This is our answer.
### Test cases
```
Input          Output
helloworld     k
abcdef         p
codegolf       h
stackexchange  e
aaaaa          a
```
**This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code in bytes wins.**

[Answer]
# [Zsh](https://www.zsh.org/), 41 bytes
```
a=(+##${(s..)^1}+7)
<<<${(#)$((a%26+97))}
```
[Try it online!](https://tio.run/##dY1LCsIwGIT3PYWQCvkJFHRhEeJVhLyjjY021dZIzx6TA@RbzQNmYrBJY8CJXTBBqP3h0HVwPWykh4ZSmgMELcZsfzyRcw@wJWgavbPKOb/4yclsGBdS6SyEl8p4V2SYmRjUKiwbjcr@tahp/r5v/umGuzVaBhZX8eHjowxUySWvUh6r5DJWSX8 "Zsh – Try It Online")
`(s..)`plit, `^` RC-style expand as `+##${1[1]}+7 +##${1[2]}+7 ...`. Then `(#)` evaluate the expression as character codes.
[Answer]
# [Fig](https://github.com/Seggan/Fig), \$10\log\_{256}(96)\approx\$ 8.231 bytes
```
ica%26S+7C
```
Using [Arnauld's](https://codegolf.stackexchange.com/users/58563/arnauld) logic. Accepts a list of characters
[Try it online!](https://fig.fly.dev/#WyJpY2ElMjZTKzdDIiwiW3MsdCxhLGMsayxlLHgsYyxoLGEsbixnLGVdIl0=)
```
ica%26S+7C
         C # str -> char code, vectorises
       +7  # add 7 to each item
      S    # sum
   %26     # sum % 26
 ca        # lowercase alphabet
i          # index intro ca using result
```
# Alternate \$13\log\_{256}(96)\approx\$ 10.701 bytes
```
ica%26SM'lxca
```
[Try it online!](https://fig.fly.dev/#WyJpY2ElMjZTTSdseGNhIiwiW3MsdCxhLGMsayxlLHgsYyxoLGEsbixnLGVdIl0=)
```
ica%26SM'lxca
           ca  # lowercase alphabet
          x    # input
       M'l     # map find over x where we look for each char in ca, returns index
      S        # sum
   %26         # sum % 26
ica            # index into ca using the result
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 46
```
t;f(char*s){for(t=0;*s;)t+=*s++-97;t=t%26+97;}
```
[Try it online!](https://tio.run/##ZU/LTsMwEDwnX7EERXLiFFUcQMikX1Bx4wQVStfOQ6QOsjdQqcq3BzsuqlD3sJode2dmcdUgzjOJmmFbmdxmp3owjMq1yK3IiJe55Xz19CiopPT@gTs0zbedxn6UCp4tSanqu3YT/@O6wVNxpwkOVaeBeVSZBgvwNpA7/J3BKQZXgSFlCSur7NsOSvcSJa3q@@FnML1MCjdWe3RWC8RBqmbow2Cpwk91dCq6UeGnL49eXrfbxWISFydLBu14CIzPRfjRyaOIF8JdDywwLsZawCVXYHdwU4IXFudFzv0h0VnWLdXsaicTcfRlnFnNktTCagMpvuukuFYv/vJlIeC0dKNoNNrFiaf5Fw "C (gcc) – Try It Online")
[Answer]
# ARM Thumb machine code, 18 bytes
```
61 20 04 c9 61 3a 10 44 fb d5 1a 38 fd d2 7b 30
70 47
```
Assembler source:
```
    .syntax unified
    .arch armv7-a
    .thumb
    .globl alpha_checksum
    .thumb_func
    // Input: r1: null terminated UTF-32LE string
    // Output: r0
    // Clobbers: r0-r2
alpha_checksum:
    // Initial accumulator. Start at 'a' to cancel the checksum
    // loop adding '\0' - 'a' when the null terminator is reached.
    movs   r0, #'a'
.Lloop:
    // Load character, increment pointer
    ldmia  r1!, {r2}
    // Subtract 'a' to convert to a number, set flags
    // In the case of the null terminator, this will result in
    // -'a', which ends the loop condition below.
    subs   r2, #'a'
    // Add to the checksum, without setting the flags
    add    r0, r2
    // Loop if the subs didn't return negative,
    // which happens only with the null terminator.
    bpl    .Lloop
.Lend:
    // Calculate (checksum % 26) - 26 using a naive subtraction loop
.Lmodulo:
    // Subtract 26
    subs   r0, #26
    // Loop while it was >= 26
    bhs    .Lmodulo
    // Add 26 to correct the modulo, and 'a' to convert to ASCII.
    adds   r0, #'a' + 26
    // Return
    bx     lr
```
This can be called from C using a dummy parameter to place `ptr` in `r1`.
`ptr` is expected to be a pointer to a null terminated UTF-32LE string.
```
char32_t alpha_checksum(int dummy, const char32_t *ptr);
```
[Answer]
# [Clojure](https://clojure.org/), 65 bytes
```
(defn a[s](char(+(mod(apply + (map #(- % 97)(map int s)))26)97)))
```
[Try it online!](https://tio.run/##dY4xDsIwDEV3TmEFVbJVsTCAOAswGCdtgTSOkiLg9CEwE29@78v@4vX2SK4UtG4IwMd8Rpk4YY@zWuQY/Rt6wJkjrHEDHRz29NuuYYFMRNsdVURUMKbKBjCdnIIBZDCT816fmrw1RKs/Ab5I/duQotaN6ls6Lyx396ptw@ha979TXfkA "Clojure – Try It Online")
Ungolfed:
```
(defn alpha-checksum [s]
  (char (+ (mod (apply + (map #(- % 97) (map int s))) 26) 97)))
```
[Answer]
# [Wren](https://github.com/munificent/wren), 47 bytes
```
Fn.new{|s|(s.bytes.reduce{|x,y|x+7+y}+7)%26+97}
```
[Try it online!](https://tio.run/##FYuxCsMgGIT3PoUECorBoUNDh06FzoWMpYPR3yTUaFHbRGKe3cZb7uPjbnZg8o87pK75bpiBeU0@Yc@6GMAzB/IrYE1LHdNCGxo32pDj6UwvzZaVdQh7NBr0rAbQ2s7WaVnVFe@EBLWDsBJ6qwv6wMUbFjFw00PZlFQvgtYDQm30ASb2caMJuA179Uw5O932/8MWqZjgWmNPCDls@Q8 "Wren – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 8 bytes
```
§βΣＥＳ⌕βι
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMOxxDMvJbVCI0lHIbg0V8M3sUDDM6@gtCS4BCidrqGpo@CWmZcCks7UBAHr//@LSxKTs1MrkjMS89JT/@uW5QAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
    Ｓ       Input string
   Ｅ        Map over characters
       ι    Current character
     ⌕      Find index in
      β     Predefined variable lowercase alphabet
  Σ         Take the sum
§           Cyclically indexed into
 β          Predefined variable lowercase alphabet
            Implicitly print
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 25 bytes
```
0T1>`l`L
+T`l__L`zlL_`^..
```
[Try it online!](https://tio.run/##FcFBCoAgEADA@/4jCAKpD3Tt4tFz7qarRouCBUWfN5qpfO2ZWtcv2EYzzSioYTAo1mp8RVtclWotsUi5SxUPtDnPAVzxHIsEOC9yBz8uUY4M9PsA "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
0T1>`l`L
```
Uppercase all letters after the first.
```
+T`l__L`zlL_`^..
```
While there are at least two letters, repeatedly rotate the first letter backwards and the second letter forwards in the alphabet, however the first letter rotates back from `a` to `z` while the second letter drops off when it passes `Z`, allowing subsequent letters to be processed.
The `l` and `L` in the patters expand to the lowercase and uppercase alphabet respectively. The `_` in the source pattern is just a placeholder to allow the use of `l` and `L` in the destination pattern, while in the destination pattern it indicates that the character is to be deleted.
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 20 bytes
```
C(($+(7+A*a))%26+97)
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJDKCgkKyg3K0EqYSkpJTI2Kzk3KSIsIiIsIiIsImhlbGxvd29ybGQiXQ==)
Probably could be shorter, I feel like there are just way too many parentheses.
[Answer]
# [BQN](https://mlochbaum.github.io/BQN/), 15 bytes
```
'a'+26|·+´-⟜'a'
```
[Try it at BQN REPL](https://mlochbaum.github.io/BQN/try.html#code=Q2hlY2tzdW0g4oaQICdhJysyNnzCtyvCtC3in5wnYScKQ2hlY2tzdW0gImhlbGxvd29ybGQi)
```
'a'+26|·+´-⟜'a'
          -⟜'a'     # subtract 'a' from each letter of input
        +´          # sum
       ·            # (no-op to preserve train syntax)
    26|             # modulo 26
'a'+                # add 'a'
```
[Answer]
# [Gema](http://gema.sourceforge.net/), 77 characters
```
?=@set{s;@add{${s;};@add{@char-int{?};7}}}
\Z=@int-char{@add{@mod{$s;26};97}}
```
(Yepp. Arithmetic operations are a pain in Gema.)
Sample run:
```
bash-5.1$ echo -n helloworld | gema '?=@set{s;@add{${s;};@add{@char-int{?};7}}};\Z=@int-char{@add{@mod{$s;26};97}}'
k
```
[Try it online!](https://tio.run/##S0/NTfz/397WoTi1pLrY2iExJaVaBciohTAdkjMSi3Qz80qq7WutzWtra7liomwdgHxdkEQ1RE1uPlBPsbWRWa21JVDN//8ZqTk5@eX5RTkpAA "Gema – Try It Online")
[Answer]
# [JavaScript (V8)](https://v8.dev/), 72 bytes
```
([...s])=>String.fromCharCode(s.map(c=>t+=c.charCodeAt()+7,t=0)|t%26+97)
```
[Try it online!](https://tio.run/##Zc6xDoIwEIDh3adoSEzaoMU4iA4lMTyCo3GoR1uQQknboIPvXiGgA954@XL/PXjPHdiq89v@GCQL@EopdTfCsou3VauotKbJS25zUwjsaMM7DCzzMQMK8/rsMYnTjWc78vbr/SE@pSSAaZ3RgmqjsMRRKbQ2T2N1ESGECEFJgurVAvE7FEKOAP1Qt0QwFJXRM5tQuUTOc6jFa/iwVSKakPjLjfOtzZd4@AA "JavaScript (V8) – Try It Online")
[Answer]
# PowerShell, 54 bytes
```
$s.tochararray()|%{$r+=([char]$_)-97};[char]($r%26+97)
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfmvUqxgq6AEYuaX5xflpCgBRfRK8pMzEosSi4oSKzU0a1SrVYq0bTWiQWKxKvGaupbmtdYQnoZKkaqRmbalueb//wA "PowerShell – Try It Online")
[Answer]
# [Pip](https://github.com/dloscutoff/pip), 16 bytes
```
zPK$+(A*a-97)%26
```
[Try It Online!](https://dso.surge.sh/#@WyJwaXAiLCIiLCJ6UEskKyhBKmEtOTcpJTI2IiwiIiwiIiwiaGVsbG93b3JsZCJd)
[Answer]
## x86‑64 assembly machine code, 30 B
### input
* unsigned length of string in 64‑bit register `rdi`
* address of string buffer in 64‑bit register `rsi`
### code listing
```
 1                 alphabet_checksum:
 2 0000 6A61        push 'a'                    ; push(97)
 3 0002 58          pop rax                     ; pop(rax)
 4 0003 F7E7        mul edi                     ; edx○eax ≔ eax × edi
 5
 6 0005 F7D8        neg eax                     ; eax ≔ −eax; CF ≔ eax ≠ 0
 7 0007 7310        jnc .adjust                 ; if ¬CF then goto adjust
 8                 .sum:
 9 0009 0FB64C3EFF  movzx ecx, byte [rsi+rdi-1] ; ecx ≔ (rsi + rdi − 1)↑
10 000E 01C8        add eax, ecx                ; eax ≔ eax + ecx
11 0010 FFCF        dec edi                     ; edi ≔ edi − 1; ZF ≔ edi = 0
12 0012 75F5        jnz .sum                    ; if ¬ZF then goto sum
13
14 0014 6A1A        push 26                     ; push(26)
15 0016 5F          pop rdi                     ; pop(rdi)
16 0017 F7F7        div edi                     ; edx ≔ edx○eax mod edi
17                 .adjust:
18 0019 92          xchg eax, edx               ; eax ≔ edx
19 001A 83C061      add eax, 'a'                ; eax ≔ eax + 97
20 001D C3          ret
```
### output
* alphabet checksum as ASCII character in 64‑bit register `rax`
### limitations
* length of string must be ≤ 44,278,013, else the `mul` spills into `edx`, yet the algorithm relies on `edx` being `0` in the case of a zero-length string
[Answer]
# [Haskell](https://www.haskell.org/), 43 bytes
```
f s=['a'..]!!mod(sum[fromEnum c-97|c<-s])26
```
[Try it online!](https://tio.run/##Vcy9DoIwFAXgvU9x6QImlsFBYyKjo09AGK79oYT@EArRRH32Kigaz3Ryc@6nMbTSmBgVhKJMMc3zKkmsF1kYbal6b49utMDZfnfnBxaq1WYbLTYOCrDYnSDr@sYNkINaQUn1y/IX3xtB10DxzIVUU@NeyNqbuYcBeSuvXKOr5TybQitCboz8AJjSkrcBSzqyUJ@DJn8egCSz9/0AJOwRnw "Haskell – Try It Online")
### Same-length alternative:
```
f s=['a'..]!!mod(sum$do c<-s;1<$['b'..c])26
```
[Try it online!](https://tio.run/##VcxNDoIwEAXg/ZxiaEiQREh04UY4gicgLIa2UEJLCcVoYjx7BRSNb/UyP58i10mtva/R5UVEUZqWQWCs2LmrCYVFniXufMjCIqrmHS/j48kbanvM0dBwwd0wtv2EKdYxFkzNlr3ZUQu2R0YVF7JeGrdCNlav3U3EO3nnivpGrmdLWAnwSOAH4JIO3gZuGWCjPgMFfx6ihNX7fiBB8vQv "Haskell – Try It Online")
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang) (v2), 36 bytes
```
;=sP;=i@O;Ws;=i+~-97iAs=s]sA+97%i 26
```
[Try it online!](https://knight-lang.netlify.app/#WyI7PXNQOz1pQE87V3M7PWkrfi05N2lBcz1zXXNBKzk3JWkgMjYiLCJoZWxsb3dvcmxkIiwiMi4wIl0=)
I feel like you can golf better but i tried for awhile and gave up
[Answer]
# [><> (Fish)](https://esolangs.org/wiki/Fish), ~~26~~ 24 bytes
* -2 bytes thanks to @Eminga. I didn't want to change the input mode to stack though so I didn't use all the golfing potential. Also I wanted to exit properly and not just error.
```
0i:0(?v+7+2d*%!
o+"a"~<;
```
[Animated Version](https://mousetail.github.io/Fish/#eyJ0ZXh0IjoiMGk6MCg/dis3KzJkKiUhXG5vK1wiYVwifjw7IiwiaW5wdXQiOiJoZWxsb3dvcmxkIiwic3RhY2siOiIiLCJtb2RlIjoibnVtYmVycyJ9)
## Explanation:
```
0
```
Push 0, the starting value
```
i:0(?v
```
Check if the input is negative, if so go down.
```
+7+2d*%
```
Add 7+the input to the accumulator, then mod 26
```
!
```
Skip the 0 the second time, since the accumulator is already set
```
~"a"+o;
```
(Reversed in the program)
Print "a" + the accumulator.
[Answer]
# [Uiua](https://uiua.org), 11 [bytes](https://www.uiua.org/pad?src=U0JDUyDihpAgK0BcMOKKlwpEZWNvZGUg4oaQIOKHjOKKjy0x4pa9wrEu4o2Y4ouv4oav4oqCwq8x4qe74ouv4qe7LOKHjOKItSjihpjCrzHii68rMjU2KSAtQFwwKzEKJnAg4oqCIjggYml0IGVuY29kaW5nOlx0IiBTQkNTICLih4ziio8tMeKWvcKxLuKNmOKLr-KGr-KKgsKvMeKnu-KLr-Knuyzih4ziiLUo4oaYwq8x4ouvKzI1NikiIOKKgitAXDDih6ExMjkiLiziiLY74oiYwqzCscKv4oy14oia4peL4oyK4oyI4oGFPeKJoDziiaQ-4omlKy3Dl8O34pe_4oG_4oKZ4oan4oal4oig4qe74paz4oeh4oqi4oeM4pmt4ouv4o2J4o2P4o2W4oqa4oqb4oqd4pah4oqU4omF4oqf4oqC4oqP4oqh4oav4oaZ4oaY4oa74per4pa94oyV4oiK4oqXL-KIp1xc4oi14omh4oi64oqe4oqg4o2l4oqV4oqc4oip4oqT4oqD4oqZ4ouF4o2Y4o2c4o2a4qyaJz_ijaPijaQh4o6L4oas4pqCzrfPgM-E4oiefl9bXXt9KCnCr0AkXCLihpB8IyIKJnAg4oqCImRlY29kZWQ6XHQiIERlY29kZSAiwqPCsS0xwrjChy7DjMKlwrPCsMKIMcKfwqXCnyzCo8K_KMK1wogxwqUrMjU2KSIg4oqCK0BcMOKHoTEyOSIuLOKItjviiJjCrMKxwq_ijLXiiJril4vijIrijIjigYU94omgPOKJpD7iiaUrLcOXw7fil7_igb_igpnihqfihqXiiKDip7vilrPih6HiiqLih4zima3ii6_ijYnijY_ijZbiipriipviip3ilqHiipTiiYXiip_iioLiio_iiqHihq_ihpnihpjihrvil6vilr3ijJXiiIriipcv4oinXFziiLXiiaHiiLriip7iiqDijaXiipXiipziiKniipPiioPiipnii4XijZjijZzijZrirJonP-KNo-KNpCHijovihqzimoLOt8-Az4TiiJ5-X1tde30oKcKvQCRcIuKGkHwjIg==)
```
+@a◿26/+-@a
```
[Try it!](https://uiua.org/pad?src=ZiDihpAgK0Bh4pe_MjYvKy1AYQoKZiAiaGVsbG93b3JsZCIKZiAiYWJjZGVmIgpmICJjb2RlZ29sZiIKZiAic3RhY2tleGNoYW5nZSIKZiAiYWFhYWEi)
```
+@a◿26/+-@a
        -@a  # convert string to code points
      /+     # sum
   ◿26       # modulo 26
+@a          # add the letter a
```
[Answer]
# [C++ (gcc)](https://gcc.gnu.org/), ~~76~~ 73 bytes
-3 thanks to @[ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)
I think this is as much golf as you can get without using a completely different method. Other people ~~will probably prove me wrong the moment I hit "Post."~~ have in fact proven me wrong.
```
#import<ios>
int f(char*s){int t=0;for(;*s;t+=*s++-97);putchar(t%26+97);}
```
[Try it online!](https://tio.run/##jY5BCoMwEEXX9RTBUoiKULpoqdHeJZ0kKo1JSEZaEM9ujT1And2f/3h8cK5sAZbl2A/Oeqx7Gx5Jb5AoCh33ecimmLA5M2U9ZXlgWDR5KIryfsuYGzFiFE@XaxEf82oyoEchSXShl3z4CQfeG5qRKTkomnZSa/u2Xos0Y8khoKgqsCOSuiZbkEbotdhg/gQh1Q4QrJCt1XvQgBxe8rOON63csyHeH24myxc "C++ (gcc) – Try It Online")
### Ungolfed
We used `#import<ios>` so we can `putchar()`.
```
int f(char* s) {
    int t = 0;                      // Running total
    for(;*s != 0;t += *s++ - 97);   // Loop through string until we get to null byte, add to running total
    putchar(t % 26 + 97);           // Add 97 to final result and print
}
```
[Answer]
# [Arturo](https://arturo-lang.io), 29 bytes
```
$[a][+97(sum map a=>[+7])%26]
```
[Try it](http://arturo-lang.io/playground?2aJrIX)
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 91 bytes
```
++[++[->+>+<<]>>[--<<+>>]<],[[-[->+<]>]>>>>>>>,]+[<<<<<<<<<<<<<<<<<<<<<<<<<<+<[-----.[>]]>]
```
[Try it online!](https://tio.run/##dYtLCoAwDAUP9BpPEHKRkEUtVUuhCz/g7WN07/BWb5h5z20sV@nugMZIIGA2ESVihoixJVV6TdwhPpJB@Rdw1MGkYtG4H2cuvd5ly2OtDw "brainfuck – Try It Online")
```
++[++[->+>+<<]>>[--<<+>>]<]    Init memory with 1,2,3,...,127
,[[-[->+<]>]>>>>>>>,]          Reading each byte, move right that many steps
+[<<<<<<<<<<<<<<<<<<<<<<<<<<+< Go left 26 and check if empty
[-----.[>]]>]                  If not empty, give shift, output and halt
```
[Answer]
# Dyalog APL v18, 28 bytes\*
```
{a[1+26|+/1-⍨(a←¯1∘⎕C⎕A)⍳⍵]}
```
Assuming that indices start from one (`⎕IO←1`).
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
\*: APL can be written in its own legacy charset (defined by `⎕AV`) instead of Unicode; therefore an APL program that only uses ASCII characters and APL symbols can be scored as 1 char = 1 byte.
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2), 6 [bytes](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md)
```
Ä⁻S⁺ÄL
```
[Try it online!](https://Not-Thonnu.github.io/run#aGVhZGVyPSZjb2RlPSVDMyU4NCVFMiU4MSVCQlMlRTIlODElQkElQzMlODRMJmZvb3Rlcj0maW5wdXQ9aGVsbG93b3JsZCZmbGFncz0=)
#### Explanation
```
Ä⁻S⁺ÄL  # Implicit input
Ä       # 1-based index in alphabet
 ⁻      # Decrement to make 0-indexed
  S     # Sum the resulting list
   ⁺    # Increment for 1-indexing
    Ä   # 1-based convert to letter
     L  # Lowercase it
        # Implicit output
```
]


[Question]
      [
# Background
The [Copeland–Erdős constant](https://en.wikipedia.org/wiki/Copeland%E2%80%93Erd%C5%91s_constant) is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is
```
0.23571113171923293137414...
```
See also [OEIS A033308](https://oeis.org/A033308).
Copeland and Erdős proved that this is a [normal number](https://en.wikipedia.org/wiki/Normal_number). This implies that every natural number can be found at some point in the decimal expansion of the Copeland-Erdős constant.
# The challenge
Given a positive integer, express it in base 10 (without leading zeros) and output the index of its first appearance within the sequence of decimal digits of the Copeland–Erdős constant.
Any reasonable input and output format is allowed, but input and output should be in base 10. In particular, the input can be read as a string; and in that case it can be assumed not to contain leading zeros.
Output may be 0-based or 1-based, starting from the first decimal of the constant.
The actual results may be limited by data type, memory or computing power, and thus the program may fail for some test cases. But:
* It should work in theory (i.e. not taking those limitations into account) for any input.
* It should work in practice for at least the first four cases, and for each of them the result should be produced in less than a minute.
# Test cases
Output is here given as 1-based.
```
13       -->         7   # Any prime is of course easy to find
997      -->        44   # ... and seems to always appear at a position less than itself
999      -->      1013   # Of course some numbers do appear later than themselves
314      -->       219   # Approximations to pi are also present
31416    -->     67858   # ... although one may have to go deep to find them
33308    -->     16304   # Number of the referred OEIS sequence: check
36398    -->     39386   # My PPCG ID. Hey, the result is a permutation of the input!
1234567  -->  11047265   # This one may take a while to find
```

[Answer]
# Python 2, 64 bytes
```
f=lambda n,k=2,m=1,s='':-~s.find(`n`)or f(n,k+1,m*k*k,s+m%k*`k`)
```
Returns the 1-based index. Test it on [Ideone](http://ideone.com/hDwIIu).
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 14 bytes
Uses **0-indexed output**. Prime functions in osabie are *very* inefficient. Code:
```
[NØJD¹å#]¹.Oð¢
```
Explanation:
```
[       ]        # Infinite loop...
 N               # Get the iteration value
  Ø              # Get the nth prime
   J             # Join the stack
    D            # Duplicate this value
     ¹å#         # If the input is in this string, break out of the loop
         ¹.O     # Overlap function (due to a bug, I couldn't use the index command)
            ð¢   # Count spaces and implicitly print
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=W07DmEpEwrnDpSNdwrkuT8OwwqI&input=OTk5).
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 17 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ÆRDFṡL}i
Ḥçßç?
çD
```
Returns the 1-based index. [Try it online!](http://jelly.tryitonline.net/#code=w4ZSREbhuaFMfWkK4bikw6fDn8OnPwrDp0Q&input=&args=MQ) or [verify most test cases](http://jelly.tryitonline.net/#code=w4ZSREbhuaFMfWkK4bikw6fDn8OnPwrDp0QKxbzDh-KCrEc&input=&args=MTMsIDk5NywgOTk5LCAzMTQsIDMxNDE2LCAzMzMwOCwgMzYzOTg).
I've verified the last test case locally; it took 8 minutes and 48 seconds.
### How it works
```
çD        Main link. Argument: n (integer)
 D        Decimal; yield A, the array of base 10 digits of n.
ç         Call the second helper link with arguments n and A.
Ḥçßç?     Second helper link. Left argument: n. Right argument: A.
Ḥ         Unhalve; yield 2n.
    ?     If...
   ç        the first helper link called with 2n and A returns a non-zero integer:
 ç            Return that integer.
          Else:
  ß           Recursively call the second helper link with arguments 2n and A.
ÆRDFṡL}i  First helper link. Left argument: k. Right argument: A.
ÆR        Prime range; yield the array of all primes up to k.
  DF      Convert each prime to base 10 and flatten the resulting nested array.
     L}   Yield l, the length of A.
    ṡ     Split the flattened array into overlapping slices of length l.
       i  Find the 1-based index of A in the result (0 if not found).
```
## Alternate version, 11 bytes (non-competing)
```
ÆRVw³
ḤÇßÇ?
```
The `w` atom did not exist when this challenge was posted. [Try it online!](http://jelly.tryitonline.net/#code=w4ZSVnfCswrhuKTDh8Ofw4c_&input=&args=OTk5)
### How it works
```
ḤÇßÇ?  Main link. Argument: n (integer)
Ḥ      Unhalve; yield 2n.
    ?  If...
   Ç     the helper link called with argument 2n returns a non-zero integer:
 Ç         Return that integer.
       Else:
  ß      Recursively call the main link with argument 2n.
ÆRVw³  Helper link. Argument: k (integer)
ÆR     Prime range; yield the array of all primes up to k.
  V    Eval; concatenate all primes, forming a single integer.
    ³  Yield the first command-line argument (original value of n).
   w   Windowed index of; find the 1-based index of the digits of the result to
       the right in the digits of the result to the left (0 if not found).
```
[Answer]
## Actually, 19 bytes
```
╗1`r♂Pεj╜@íu`;)╓i@ƒ
```
Takes a string as input and outputs the 1-based index of the substring
[Try it online!](http://actually.tryitonline.net/#code=4pWXMWBy4pmCUM61auKVnEDDrXVgOynilZNpQMaS&input=IjEzIg)
Explanation:
```
╗1`r♂Pεj╜@íu`;)╓i@ƒ
╗                    push input to register 0
  `r♂Pεj╜@íu`;)      push this function twice, moving one copy to the bottom of the stack:
   r♂Pεj               concatenate primes from 0 to n-1 (inclusive)
        ╜@íu           1-based index of input, 0 if not found
1              ╓     find first value of n (starting from n = 0) where the function returns a truthy value
                i@   flatten the list and move the other copy of the function on top
                  ƒ  call the function again to get the 1-based index
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 6 bytes
```
€ṁdİpd
```
[Try it online!](https://tio.run/##yygtzv7//1HTmoc7G1OObChI@f//v7GhCQA "Husk – Try It Online")
Prime number infinite list babyyyyy
[Answer]
# Julia, 55 bytes
```
\(n,s="$n",r=searchindex(n|>primes|>join,s))=r>0?r:3n\s
```
Returns the 1-based index. Completes all test cases in under a second. [Try it online!](http://julia.tryitonline.net/#code=XChuLHM9IiRuIixyPXNlYXJjaGluZGV4KG58PnByaW1lc3w-am9pbixzKSk9cj4wP3I6M25ccwoKZm9yIG4gaW4gKDEzLCA5OTcsIDk5OSwgMzE0LCAzMTQxNiwgMzMzMDgsIDM2Mzk4LCAxMjM0NTY3KQogICAgQHByaW50ZigiJTh1IC0tPiAlOXVcbiIsIG4sIFwobikpCmVuZA&input=)
[Answer]
# Pyth, 17 bytes
```
 fhJxs`MfP_YSTz2J
```
Leading space is important.
[Test suite.](http://pyth.herokuapp.com/?code=+fhJxs%60MfP_YSTz2J&test_suite=1&test_suite_input=13%0A997%0A314&debug=0)
[Answer]
# [J](http://jsoftware.com), 37 bytes
```
(0{":@[I.@E.[:;<@":@p:@i.@]) ::($:+:)
```
Input is given as a base 10 integer and the output uses zero-based indexing.
## Usage
```
   f =: (0{":@[I.@E.[:;<@":@p:@i.@]) ::($:+:)
   f 1
4
   f 13
6
   f 31416
67857
```
## Explanation
This first call treats the verb as a monad, however subsequent calls which may occur recursively treat it as a dyad.
```
0{":@[I.@E.[:;<@":@p:@i.@]  Input: n on LHS, k on RHS
                         ]  Get k
                      i.@   Get the range [0, 1, ..., k-1]
                   p:@      Get the kth prime of each
                ":@         Convert each to a string
              <@            Box each string
           [:;              Unbox each and concatenate to get a string of primes
     [                      Get n
  ":@                       Convert n to a string
      I.@E.                 Find the indices where the string n appears in
                            the string of primes
0{                          Take the first result and return it - This will cause an error
                            if there are no matches
(...) ::($:+:)  Input: n on RHS, k on LHS
(...)           Execute the above on n and k
      ::(    )  If there is an error, execute this instead
           +:   Double k
         $:     Call recursively on n and 2k
```
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-rprime`, 48 bytes
0-based.
```
->n{s=""
Prime.find{s<<_1.to_s=~/#{n}/}
$`.size}
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72kqDSpcnW0km5RQVFmbqpS7CI326WlJWm6FjcNdO3yqottlZS4AkBSemmZeSnVxTY28YZ6JfnxxbZ1-srVebX6tVwqCXrFmVWptRB9qwoU3KKNDU0MzWIhAgsWQGgA)
[Answer]
# [Raku](https://raku.org/), 45 bytes
```
{{$~={$_ x.is-prime}(++$)}...*~~/$_/;$/.from}
```
[Try it online!](https://tio.run/##DcpLCoAgFAXQrVziEX3oSRSFlG1FGiQESWGTQnTr1uDMzrW5Y0j2RW6gkvcUlSeNh/e7udxut1DUNZWBmasYBWkxkWDjThvSvb7I/qwWeAPSIYM5Hea2g5TjT6Jr@yV9 "Perl 6 – Try It Online")
Really had to dig deep to bring the byte count way down here. The code generates a warning, but oh well!
The first bracketed expression generates strings consisting of the concatenation of successive primes. `++$` increments an anonymous state variable, and that number is passed to an anonymous function `{ $_ x .is-prime }`, which replicates the stringified number once if it's prime, and zero times (ie, to an empty string) if it isn't. That string is appended to another anonymous state variable that keeps the concatenation of all primes seen so far with `$ ~=`. The sequence looks like `2, 23, 23, 235, 235, 2357, 2357, 2357, 2357, 235711, ...`, with a repeated element whenever there isn't a prime. Very inefficient!
The sequence terminates when the ending condition `* ~~ /$_/` is met; that is, when the concatenated string of primes matches the input number interpolated into a regex. That has the side effect of storing the resulting Match object into `$/`. Then the function just returns `$/.from`, the starting position of the match in the string of primes.
[Answer]
## PowerShell v2+, 90 bytes
```
for($a="0.";!($b=$a.IndexOf($args)+1)){for(;'1'*++$i-match'^(?!(..+)\1+$)..'){$a+=$i}}$b-2
```
Combines the logic of my [Find the number in the Champernowne constant](https://codegolf.stackexchange.com/a/66884/42963) answer, coupled with the prime generation method of my [Print the nth prime that contains n](https://codegolf.stackexchange.com/a/80446/42963) answer, then subtracts `2` to output the index appropriately (i.e., not counting the `0.` at the start).
Takes input as a string. Finds the `999` one in about seven seconds on my machine, but the `33308` one in quite a bit longer (*edit - I gave up after 90 minutes*). Should theoretically work for any value up to index `[Int32]::Maxvalue` aka `2147483647`, as that's the maximum length of .NET strings. Will likely run into memory issues long before that happens, however.
]