text:
Scrabble scorer
Challenge:
Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English.
Rules:
The score of each letter is as follows (use this even if there are other versions of the game):
1 point: E, A, I, O, N, R, T, L, S, U
2 points: D, G
3 points: B, C, M, P
4 points: F, H, V, W, Y
5 points: K
8 points: J, X
10 points: Q, Z

The score of a string is simply the sum of the scores of each of the letters used. You may assume that you have plenty of tiles available, so long words, and words with many of the same letters are valid input.
Test cases:
ABC       ->    7
PPCG      ->   11
STEWIE    ->    9
UGPYKXQ   ->   33
FIZZBUZZ  ->   49
ABCDEFGHIJKLMNOPQRSTUVWXYZ  -> 87

The shortest answer in each language wins! The input and output formats are flexible, so you may take the input as an array of characters (upper or lower case) if you want.

I'm hoping to see a MATLAB/Octave solution. All my attempts were horribly long... =/

I'm hoping to see a Beatnik solution. Cuz, you know, that would be the right tool for the job.

@StewieGriffin Does 85 bytes count as horribly long?

Hasn't Mathematica a built-in for it?

@StewieGriffin Down to 73 with Octave now.

@LuisMendo Is 85 bytes horribly long compared to 50...? :)

@StewieGriffin I've been thinking of making a more complex Scrabble challenge. Unless someone else does it first I may (finally) go ahead and do that.

@manassehkatz you should definitely give it a go! I highly recommend that you post the challenge in the Sandbox to get some feedback and help with it before posting it on the main site. Complex challenges are notoriously difficult to get right without any feedback.

@StewieGriffin Are we allowed to have the program fail if the input is longer than what fits on a Scrabble board (15)?

It should work for the test cases @mbomb007. You have plenty of tiles (and boards) available. You may add it as a "this would work if...", if it's an interesting/fun/short solution. :-)

@StewieGriffin Added to Sandbox - please take a look at it.

sed 4.2.2, 81
s/[QZ]/JD/g
s/[JX]/KB/g
s/K/FE/g
s/[FHVWY]/BE/g
s/[BCMP]/DE/g
s/[DG]/EE/g
s/./1/g

Output is in unary.
Reduces each letter to a combination of lower-scoring letters until all letters are 1-scorers.  Then replaces those with 1s to give a unary count.
Try it online!

Octave, 50 bytes
@(t)'				'/3*sum(65:90==t')'

Try it online!
Challenge accepted. Explanation:
@(t)             % Define anonymous function taking a single argument t.
    ' ... '/3    % Row vector with letter scores. Corresponds to char([1 3 3 2 ...]*3).
                 % The factor 3 was necessary to avoid a newline.

*                % Dot product (yes, * is dot product, .* is not. Go figure). Equivalent to sum of element-wise products.
     65:90       % Alphabet
          ==t'   % Broadcast equality with input string.
 sum(         )  % Sum this matrix. Gives the count of each letter in the alphabet
               ' % Transpose into column vector for dot product

Very clever! Using unprintables was a nice touch! :)

@StewieGriffin It's only one byte compared to -47 but that's code-golfing for you!

Sigh. Well and truly out golfed. I hadn't realised you could use == like that in Octave. Doesn't work in MATLAB. Good to know.

@Sanchises Interesting. I've been using R2014b up until recently (just switched to R2017a). Haven't had a chance to explore the differences.

@TomCarpenter I don't mean to rub any salt in the wound, but the 'old' way of doing this (with bsxfun) is also shorter at 61 bytes: Try it online!

WAT 50 bytes I don't even

@LuisMendo This may just be the first time I properly outgolfed you.

"properly" is an understatement for 35 bytes :-D

I had tried encoding the scores as unprintables but the newlines screwed it up! Nicely done!

Haskell, 86 84 bytes
f s=length s+sum[n|x<-s,(n,y)<-zip(9:7:[1..])$words"QZ JX DG BCMP FHVWY K",x`elem`y]

Try it online!
Explanation
Most letters give a score of 1 and thus we don't need to keep track of these, instead we just decrement each score (saves 1 byte on 10 as well) and then add the length of the string to the resulting score.
Thanks @nimi for -2 bytes (rearanging the words and using [1..] instead of [4,3..])!

zip[1..]$words"DG BCMP FHVWY K . . JX . QZ" gives another alternative with equal length

Beatnik, 733 bytes
Since it really had to be done, here it is.  It was a really nasty to debug and provided a few challenges.
Input must be uppercase letters only.
Output is unary (hope that is OK?)
J K ZZZZZZK Z ZD ZB ZZZZZZZZZZZZZZZZZA K A Z ZD ZB ZZZZZZZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZZZKD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZZD K A Z ZD ZB ZZZZZZZZZZZZ K A Z ZD ZB ZZZZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZKA K A Z ZD ZB ZZZZZZZZZKF K A Z ZD ZB ZZZZZZZZZZK K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZZB K A Z ZD ZB ZZZZZZZZKD K A Z ZD ZB ZZZZZZZK K A Z ZD ZB ZZZZKB K A Z ZD ZB ZZZZZZKF K A Z ZD ZB ZZZZZZB K A Z ZD ZB ZZZZZFB K A Z ZD ZB ZZZZZA K A Z ZD ZB ZZZAK K A Z ZD ZB ZZZ K A Z ZD ZB ZD K A Z ZD ZB ZKB K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K ZZZZKF KF K A ZKA ZZZZZZZZZZZZZZZZZZY

Try it online!
General process is:

get character from input
subtract 65
check if result is 0

if 0 jump specified amount of words.
otherwise subtract 1 and repeat check.

the jump targets are push print operations followed be a loop back to beginning of program.

Ends with an error.
A more complete explanation:
J K ZZZZZZK Z ZD               # Get input and subtract 65
ZB ZZZZZZZZZZZZZZZZZA K A Z ZD # Character A - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZKF K A Z ZD  # Character B - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZB K A Z ZD   # Character C - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZZ K A Z ZD    # Character D - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZZKD K A Z ZD   # Character E - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD     # Character F - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZZD K A Z ZD     # Character G - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZ K A Z ZD       # Character H - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZZZB K A Z ZD      # Character I - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKA K A Z ZD        # Character J - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZKF K A Z ZD        # Character K - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZZK K A Z ZD        # Character L - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD         # Character M - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZZB K A Z ZD         # Character N - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZZKD K A Z ZD         # Character O - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZZK K A Z ZD           # Character P - if 0 jump to print, otherwise subtract 1
ZB ZZZZKB K A Z ZD             # Character Q - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZKF K A Z ZD           # Character R - if 0 jump to print, otherwise subtract 1
ZB ZZZZZZB K A Z ZD            # Character S - if 0 jump to print, otherwise subtract 1
ZB ZZZZZFB K A Z ZD            # Character T - if 0 jump to print, otherwise subtract 1
ZB ZZZZZA K A Z ZD             # Character U - if 0 jump to print, otherwise subtract 1
ZB ZZZAK K A Z ZD              # Character V - if 0 jump to print, otherwise subtract 1
ZB ZZZ K A Z ZD                # Character W - if 0 jump to print, otherwise subtract 1
ZB ZD K A Z ZD                 # Character X - if 0 jump to print, otherwise subtract 1
ZB ZKB                         # Character Y - if 0 jump to print, otherwise subtract 1
K ZZZZKF KF                    # Jump Point for print 1111111111
K ZZZZKF KF                    #
K ZZZZKF KF                    # Jump Point for print 11111111
K ZZZZKF KF                    #
K ZZZZKF KF                    #
K ZZZZKF KF                    # Jump Point for print 11111
K ZZZZKF KF                    # Jump Point for print 1111
K ZZZZKF KF                    # Jump Point for print 111
K ZZZZKF KF                    # Jump Point for print 11
K ZZZZKF KF                    # Jump Point for print 1
K A ZKA ZZZZZZZZZZZZZZZZZZAAAA # Jump back to start

Golfed.

@jimmy23013 very nice, you should post that one up.

Pyth, 40 bytes
sm+2x.e}dbc." zØÍ jÙ¹>;%OG5§"\ 1

Try it here
Explanation
sm+2x.e}dbc." zØÍ jÙ¹>;%OG5§"\ 1
 m                              Q  For each character in the (implicit) input...
    x.e  b                     1   ... find the first index in...
          c." zØÍ jÙ¹>;%OG5§"\     ['dg','bcmp','fhvwy','k','','','jx','','qz']
       }d                          ... containing the character...
  +2                               ... 2-indexed.
s                                  Take the sum.

Brain-Flak, 210, 204, 198, 184, 170 bytes
({<([{}]<>(({}{}))(([][][][][])<((([]())<([][])>))((((()))))>)[](((()()())<((()))>)((())()()()()))((())()()())((()())()())[]((((())())()))(())){({}<{}>())}>{}{}<{{}}><>})

Try it online!
Thanks to @JoKing for saving 14 bytes!
Readable version:
({              # For each character

                # Push array of letter scores
                # Also adjust character to 1-indexing
        <([{}]<>
        (({}{}))    # Push 2 0s
        (([][][][][])   # 10
        <((([]())   # 4
        <([][])>    # 8
        ))      # 4,4
        ((((()))))> # 1,1,1,1
        )       # 10
        []      # Add 12 to difference
        (((()()())  # 3
        <((()))>    # 1,1
        )       # 3
        ((())()()()())) # 1, 5
        ((())()()())    # 1, 4
        ((()())()())    # 2, 4
        []      # Add 22 to difference
        ((((())())()))  # 1,2,3
        (())        # 1
        )   # Push 65-char

        {({}<{}>())} # Index character into score array
        >
        {}{}         # Add score to running total
        <{{}}><>     # Clear the stack

})               # Implicit print of total score

170 bytes

For a given definition of 'readable' :)

I made an edit to try and clarify the explanation, feel free to rollback if you find an issue.

Python 2, 78 bytes
lambda x:sum(map(('ABCEIKLMNOPRSTU'+'BCDGMPQZ'*2+'FHJJKQQVWXXYZZ'*4).count,x))

Try it online!
Shorter version, port of DanielIndie's answer, 71 70 bytes
-1 byte thanks to Sunny Patel

lambda x:sum(int('02210313074020029000033739'[ord(c)-65])+1for c in x)

Try it online!

JavaScript (Node.js), 71 66 63 62 bytes

@Arnauld awesome as always reducing 7 bytes
thanks to l4m2 for rducing by 1 byte

s=>Buffer(s).map(x=>s="02210313074020029000033739"[x-65]-~s)|s

Try it online!

Java 8, 75 71 70 bytes
s->s.chars().map(c->"\n\n".charAt(c-65)).sum()
-1 byte by changing "02210313074020029000033739".charAt(c-65)-47 to unprintables (and two \n) so the -47 can be removed. Inspired by @Sanchises' Octave answer.
Try it online.
s->          // Method with String parameter and integer return-type
  s.chars()  //  Loop over the characters as IntStream
   .map(c->"\n\n".charAt(c-65))
             //   Convert the character to its value
   .sum()    //   And sum it all together

R, 90 63 bytes
function(W,u=utf8ToInt)sum(u('

')[u(W)-64])

Try it online!
Takes input as an uppercase string. R handles unprintables and multiline strings without issues, so that's nice. Now we're almost twice the external package!
And because CRAN has so many random goodies:
R + ScrabbleScore 31 bytes
ScrabbleScore::sws(scan(,""),F)

Try it online!
Sadly, sws checks for validity by default.

Had a play with the score list and trimmed a couple

@MickyT nice! I played around with unprintables and re-using utf8ToInt instead of match and managed to get a few more down!

Octave / MATLAB, 85 bytes
@(x)sum([1:4 7 9]*any(reshape(char(strsplit('DG BCMP FHVWY K JX QZ')),6,1,5)==x,3)+1)

Try it online!

Better than my attempts  :-) still longer than I would have thought before I tried it though... You had a very different approach to it!

Jelly, 19 bytes
Oị“ÆẠḃbṂƬɠF#ṁ²’ḃ⁵¤S

A monadic link accepting a list of upper-case characters which returns an integer
Try it online! Or see the test-suite.
How?
Oị“ÆẠḃbṂƬɠF#ṁ²’ḃ⁵¤S - Link: list of characters
O                   - ordinals ('A'->65, B->66...)
                 ¤  - nilad followed by link(s) as a nilad:
  “ÆẠḃbṂƬɠF#ṁ²’     -   literal 14011114485013321424185131
                ⁵   -   literal 10
               ḃ    -   bijective-base = [1,3,10,1,1,1,1,4,4,8,4,10,1,3,3,2,1,4,2,4,1,8,5,1,3,1]
 ị                  - index into (1-based & modular) (vectorises)
                    -  i.e. mapping from: O P  Q R S T U V W X Y  Z A B C D E F G H I J K L M N)
                  S - sum

Haskell, 66 bytes
sum.map(\c->1+read["02210313074020029000033739"!!(fromEnum c-65)])

Try it online! Same approach as DanielIndie's JavaScript answer.

Haskell, 82 81 bytes
sum.map(\c->1+sum(read.pure<$>lookup c(zip"DGBCMPFHVWYKJXQZ""1122223333347799")))

Try it online!

Emojicode, 358 bytes
➡s 0ls➕sa1e1i1l1n1o1r1s1t1u1d2g2b3c3m3p3f4h4v4w4y4k5j8x8q10z10ls 10

Try it online!
Explanation:
I changed the variable names from single letters to more meaningful words, and expanded some parts of my code to hopefully make it more readable for people unfamiliar with the language. You can test the expanded program here.
       define a class that takes a string
 ➡     define a method that returns a string
  values     create int dictionary
   a1 e1 i1 l1 n1 o1 r1 s1 t1 u1 d2 g2
   b3 c3 m3 p3 f4 h4 v4 w4 y4 k5 j8 x8
   q10 z10
           ^ dictionary contains letters(keys) and their numerical values

  score 0                          declare 'score' variable and set to 0
   iterator                      transform input string to iterator
    letter iterator                 iterate over each byte in input string
     score➕score values letter    add value of each letter to score

  score 10     return the score as a string

           begin the program here
 abc     call scoring method and print the score
 ppcg     repeat with other test cases
 stewie
 fizzbuzz
 abcdefghijklmnopqrstuvwxyz

ouch... my eyes... is there an option on golf.se to hide some specific langages? ^^

@OlivierDulac There's probably a way to prevent the browser from rendering emoji specially. They do each have standard Unicode black and white characters associated with them.

PowerShell, 60 bytes
$args|% t*y|%{$s+='02210313074020029000033739'[$_-65]-47}
$s

Try it online!

05AB1E, 21 bytes
Takes input as a lowercase list of characters.
•_JÊ¿ùã$Ƶ½œM•11вAIkèO

Try it online!
or as a Test suite

Octave, 73 bytes
@(x)sum('09977433333222211'(([~,y]=ismember(x,'QZJXKFHVWYBCMPDG'))+1)-47)

Try it online!
Uses ismember to map each character in the input stream x onto it's index in the lookup string 'QZJXKFHVWYBCMPDG'. Any element not found will be mapped to an index of 0 (this will include the 1-point characters).
Next we add 1 to the index to make the 0's become valid 1-index references, and lookup into the string '09977433333222211'. This is one element longer than the first lookup string. The digits represent the point value of each element in the original string, minus 1, with the extra element being a '0' at the beginning .
Finally the resultant string is converted to integers by subtracting 47 ('0'-1), yielding the point value for each letter, and all point values are then summed.

Very clever! :)

C++, 95 bytes
char*m="02210313074020029000033739";
int f(char*p){int n=0;while(*p)n+=m[*p++-65]-47;return n;}

Try it online (not a TIO link sorry)
Explanation:

Declares m, an array of the values of each letter in order, minus 1. The minus 1 is because of Q and Z: I couldn't have a two digit number in there
Iterates through through the string p until we get to null character, and adds the score of the number (*p gives us the letter, and -65 so we can properly index the array). Since m is a char* it converts to a char so we minus 48 so bring it back to 0, but add 1 since m is declared as one score less for each character.

I'm not an avid poster here so I hope I've done this correctly. I believe they returning n counts as printing the value, and that declaring a function is fine.

Very nice! The only byte you can save, is the newline: Try it online!

@movatica Why you need m?

Nice find. But it's not my post, so you should ask @Tas ;)

K (oK), 60 38 bytes
Solution:
+/1+.:'"02210313074020029000033739"65!

Try it online!
Explanation:
Index into the scores, sum up result.
+/1+.:'"02210313074020029000033739"65! / the solution
                                   65! / input modulo 65 to get position in A-Z
       "02210313074020029000033739"    / index into the scores (1 point lower)
    .:'                                / value (.:) each (') to convert to ints
  1+                                   / increase by 1
+/                                     / sum up

PowerShell, 92 bytes
$args|% T*y|%{$i+=switch -r($_){[DG]{2}[BCMP]{3}[FHVWY]{4}K{5}[JX]{8}[QZ]{10}default{1}}};$i

Try it online!
Didn't notice @Add-TheNewOne's answer before writing this, but I think it's fairly different in any case.

05AB1E, 18 bytes
•Q<ß÷λv¸Ïàœ¶•IÇè>O

Try it online!
Explanation:
•Q<ß÷λv¸Ïàœ¶•           # compressed integer 30740200290000337390221031
             IÇ         # codepoints of the input
               è        # index into the digits of the large integer
                >       # increment each
                 O      # sum

The large integer encodes the point value of each letter. Since encoding numbers in the range 1-10 would be inconvenient, we subtract 1 so that each one fits on a single digit (this is why the > is needed).
Note that indexing in 05AB1E wraps around, so the first digit of the number actually corresponds to "h" ("h"'s codepoint is 104, which is 0 mod 26). This is convenient: since numbers can't start with 0, we don't want the first digit to correspond to "a".
Alternative 18-byter:
A•Θ¡₆öηÖ&'/α°•R‡>O

Try it online!
A pushes "abcdefghijklmnopqrstuvwxyz". ‡ transliterates, replacing each letter in the input with the corresponding digit in the compressed integer. A‡ saves one byte over IÇè; unfortunately, this encoding puts "a" first, so we have to use R (reverse) to get around the issue that numbers can't start with 0.
Yet another 18-byter:
žW•Δÿ¦ÝZ=áí4_ø•‡>O

Try it online!
Same idea as above, but this one uses the obscure žW built-in to push "qwertyuiopasdfghjklzxcvbnm". žW is one byte longer than A, but it saves the R since "q" isn't a 1-point letter.

Beatnik, 379 bytes
K ZZZZKF ZD ZD ZD ZD ZD ZD ZD
K ZZZZZZZZA J Z ZD ZB B
K XA KD ZD ZF F ZA ZD KF KF ZD ZB B
K D Z ZD ZB B
K ZF Z ZD ZF KA ZA ZD ZD KF KF KF ZD ZB B
K A KD ZD ZF D ZA KF ZD ZB B
K ZF KD ZD ZB B
K D Z ZD ZB B
K A Z ZD ZB B
K ZF Z ZD ZB B
K D Z ZD ZF D ZA KF ZD ZB B
K Z KD ZD ZB B
K B Z ZD ZB B
K Z Z ZD ZB B
K A Z ZD ZF F ZA KF ZB Z
K K KD ZD ZB B
K B Z ZF A KF
KF
XX ZZZZZZZZZZZZZX

Try it online!
See also MickyT's answer.

Japt -x, 43 39 35 30 bytes
£2+`dglbcÛghvwylk¥ljx¥qz`qÊaøX

Try it online!
35 byte solution:
¬£Ò('0+#Ý03#740#È29e4+33739 g65nXc

Run it online

Retina 0.8.2, 41 bytes
T`BCDGJKMPQXZF\HVWY`221174229793
.
$*..
.

Try it online! Link includes test cases. Explanation: Like the Haskell answer, nontrivial letters are translated to 1 less than their score, and 1 is added later when the characters are converted to unary. Putting FHVWY last allows them all to map to a score of 3 + 1.

Japt, 36 bytes
¬£2+`dg
bcmp
fhvwy
k

jx

qz`·bøX
x

Takes input as a lowercase string, returns a number.
Short explanation:
¬£2+`dg
¬       // Split the input into chars,
 £      // then map over each char, returning
  2+`dg // 2 plus

qz`·bøX
    bøX // the char's index in
qz`·    // the hardcoded string split by newlines.
x       // And finally sum the whole thing.

Try it online!

Ruby, 60 bytes
->s{s.sum{|c|"BDDCBECEBIFBDBBDKBBBBEEIEK"[c.ord-65].ord-65}}

Try it online!
A lambda, accepting input as an array of (uppercase) characters and returning an integer.

Perl 5 -pF, 50 bytes
_1DG2BCMP3FHVWY4K7JX9QZ=~/\d\D*$_/,$\+=1+$&for@F}{

Try it online!

Gforth, 109 Bytes
: V s" 1332142418513113:11114484:" ; : C 0 NAME 0 DO DUP C@ 65 - V DROP + C@ 48 - ROT + SWAP 1+ LOOP DROP . ;

Input must be uppercase:
C PPCG 11 OK
Readable
\ String used as table with values for each letter in the alphabet
\ : follows 9 in the ASCII-table
: V
   s" 1332142418513113:11114484:"
;

: C
   0                   \ Initialize sum        ( sum               )
   NAME                \ Get the string        ( sum  c-addr count )
   0 DO                \ Start of loop         ( sum  c-addr       )
      DUP C@           \ Get letter            ( sum  c-addr char  )
      65 -             \ Calculate table index ( sum  c-addr index )
      V DROP + C@      \ Get table entry       ( sum  c-addr entry )
      48 -             \ Calculate entry value ( sum  c-addr value )
      ROT + SWAP       \ Update sum            ( sum' c-addr       )
      1+               \ Next character        ( sum' c-addr'      )
   LOOP
   DROP .              \ Drop c-addr and print result
;

Try it online!

C (gcc), 78 72 bytes
i;f(char*s){for(i=0;*s;)i+="\n\n"[*s++-65];s=i;}

There are actually 26 characters in that string. See the code rendered properly and run it here.
Thanks to gastropner for golfing 6 bytes.
Ungolfed version:
i; // declare a variable to store the score; it is implicitly of type int
f(char* s) { // function taking a string as argument and implicitly returning an int
    for(i = 0; // initialize the score to 0
        *s; ) // iterate over the string until we hit terminating NUL byte
        i += "\n\n"[*s++ - 65]; // this is a 26-char string containing the ASCII equivalent of each numeric scrabble value; 65 is ASCII code for 'A', mapping the alphabet onto the string
    s = i; // implicitly return the score
}

C# (.NET Core), 50 + 18 = 68 bytes
s=>s.Sum(c=>"02210313074020029000033739"[c-65]-47)

+18 bytes for using System.Linq;
Try it online!

Perl 6, 52 bytes
{TR/A..Z/02210313074020029000033739/.comb.sum+.ords}

Try it online!
Maps every character to a digit, and sums them. And adds 1 for each character because there isn't a digit 10 without incurring unicode bytes.

Excel, 91 bytes
{=LEN(A1)+SUM(0+("0"&MID("02210313074020029000033739",CODE(MID(A1,ROW(A:A),1)&"z")-64,1)))}

Explanation:

Input is in cell A1
The formula must be entered as an array formula with Ctrl+Shift+Enter, which adds the curly brackets { } to both ends.
MID(A1,ROW(A:A),1) pulls out each character in turn (and a lot of empty values, too, since it's going to return as many values as there are rows in the sheet)
CODE(MID(~)&"z") pulls out the ASCII value for the each character. The &"z" appends a z to the end of the MID() result because CODE() doesn't like empty inputs. The ASCII value for z is higher than every capital letter, though, so it's effectively ignored later.
MID("02210313074020029000033739",CODE(~)-64,1) pulls out a letter from the score string based on its ASCII value adjusted down by 64 so the letters run 1-26 instead of 65-90.
"0"&MID(~) prepends a zero to the MID() result because Excel won't let you do math with empty strings, of which there will be several.
0+("0"&MID(~)) turns all those strings into numbers.
SUM(0+("0"&MID(~))) adds up all those strings that are now numbers.
LEN(A1)+SUM(~) adds the length of the input to the sum because all the values in the score string (02210313074020029000033739) were adjusted down by one so they would all be one digit long.

There's a very similar solution in Google Sheets but it comes in at 97 bytes because ArrayFromula() is longer than {} (but at least it can handle 0 + "" = 0).
=Len(A1)+ArrayFormula(Sum(0+Mid("02210313074020029000033739",Code(Mid(A1,Row(A:A),1)&"z")-64,1)))

Well done.  I have a Excel solution using 26 SUBSTITUTE(), coming in at a hefty 527 bytes.

Wolfram Language (Mathematica), 74 bytes
Of course Wolfram|Alpha supports Scrabble scoring! This is an anonymous function.
Plus@@(First[WolframAlpha["Scrabble "<>##,"NumberData"]]&/@Characters[#])&

This doesn't work on TIO.
To run, go here, scroll down and click "Create a New Notebook »". The code to use in the notebook is in this TIO program so you can copy it. Paste each function call in its own code block. If you run too many in a single block, the execution won't complete.
Note that WolframAlpha sends a request using the Internet. Though there are other answers on PPCG that use it, I thought you should know.
This program uses the below shorter function, but calls it on each individual character of the input (sending a separate call to Wolfram|Alpha each time!)

This only works for input up to length 15, the width of a Scrabble board. (49 bytes)
First[WolframAlpha["Scrabble "<>#,"NumberData"]]&

Same as above, but will display the result in a box, along with whether the input is a valid Scrabble word. (45 bytes)
First[WolframAlpha["Scrabble "<>#,"Result"]]&

APL (Dyalog Extended), 40 bytes
+/1+⍎¨'02210313074020029000033739'[⎕A⍳⎕]

The same method as the K answer, index into a list of scores, add 1 to them, and sum.
Try it online!

nice answer. You should post it here.

Bounty will be delivered here.

Zsh + bc, 54 bytes
bc<<<$#1`tr a-z 02210313074020029000033739<<<${1///+}`

Try it online!
Pure Zsh, 55 bytes
<<<$[$#1`tr a-z 02210313074020029000033739<<<${1///+}`]

Try it online!

Python 3, 70 bytes
This isn't any better than Rod's answer (which is also 70 bytes) but it is a different approach than the other answers I see in this thread so I figured I'd submit it anyway.
lambda s:sum(0xa48441111a3113158142412331>>4*(ord(c)-97)&15for c in s)

Try it online!
Shorter version, 68 bytes
-2 bytes thanks to xnor, now making this better than the previous Python answer!
lambda s:sum(0xa48441111a3113158142412331>>ord(c)%97*4&15for c in s)

Try it online!

Welcome! It looks like you can shave a byte by distributing the 4*: Try it online!

Or, better, replace the subtraction with a mod: TIO

@xnor That's a couple good ideas. I'm sometimes too shy of order of operations when golfing! (And I entirely missed the idea of mod)

JavaScript (ES6), 69 bytes
Takes input as an array of characters.
s=>s.map(c=>t-=~'9200204703130122093733'[parseInt(c,36)*25%26],t=0)|t

Try it online!

Bash + GNU utilities, 64
sed -es/[{QZ]/JD,JX]/KB,K]/FE,FHVWY]/BE,BCMP]/DE,DG]/EE}/g|wc -c

Try it online!
Input read from STDIN.  Uses a brace expansion to generate sed expressions equivalent to those in my sed answer.

Perl 6, 55 bytes
{sum .map:{:36<Z3P8JOBRZ4X1FBXLWSVL>+>(.ord*4-260)%16}}

Try it online!
Takes an array of characters. Uses a 4-bit lookup table encoded in base-36.

Perl 5 -pF, 73 bytes
$\+=(1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,(1)x4,4,4,8,4,10)[-65+ord]for@F}{

Try it online!

Managed to save a few using =~/./g, but can't get it down as far as @nwellnhof's answer... Try it online!

My Perl6 solution is pretty similar to this, I opted to use value-1 thus only needing 0-9 which are single digits and then split 022103...

Red, 97 bytes
func[s][t: :to-integer n: 0 foreach c s[n: n - 47 + t pick{02210313074020029000033739}t c - 64]n]

Takes a string as input.
Explanation of the ungolfed solution:
f: func[s][
    n: 0                  ; n will store the sum
    foreach c s [         ; for each character in the argument
        n: n - 47 + to-integer pick {02210313074020029000033739} to-integer c - 64
                          ; find its offset from "A" (to-integer c - 64)
                          ; use this as an index in the string with scores (pick {...} ...)
                          ; to extract the score and convert it to an integer
                          ; increase it with 1 and add it to the sum
    ]
    n                     ; return the sum
]

Try it online!

Pip, 34 33 bytes
1+("3V1S1QFRU1SMQ12W7"FB36)@A_MSa

Takes input in lowercase as a command-line argument. Try it online!
Explanation
We map a function to each character of the command-line argument a and sum the results using MS.
In the function, we convert the argument _ to its ASCII code using A, and then use that to index into the magic number 30740200290000337390221031. With cyclic indexing, this maps a -> 0, b -> 2, ... , z -> 9 (one less than the Scrabble score). We then add 1 to get the correct score of each letter.
We save one byte by encoding the number in base 36 (the highest base Pip's builtin base conversion can handle) as the string "3V1S1QFRU1SMQ12W7" and then converting it from base 36 to decimal using FB.

SmileBASIC, 87 85 78 bytes
INPUT S$WHILE""<S$S=S+VAL(@2210313074020029000033739[ASC(POP(S$))-65])+1WEND?S

Old method:
INPUT S$WHILE""<S$S=S+(INSTR(@DG+@___BCMP_FHVWYK*2+"JX"*4+@QZ,POP(S$))+4)DIV 5+1WEND?S

Go, 96 94 bytes

func(i string){a,s:=`

`,0;for _,c:=range i{s+=int(a[c-65])};print(s)}

Go allows any byte sequence in a raw string, except \r and `, this saves about 3 bytes off the total.
This is just a remix of existing solutions in other languages, so no real new innovation here.
Edit: I missed the memo where we dont have to name our functions
Try it online!

Powershell with amazing 297 Bytes
Any idea to make the script shorter?
$1=read-Host
$s=0
$l=$1.ToCharArray()
$l|%{switch($_){{'E','A','I','O','N','R','T','L','S','U'-contains$_}{$s+=1}{'D','G'-contains$_}{$s+=2}{'B','C','M','P'-contains$_}{$s+=3}{'F','H','V','W','Y'-contains$_}{$s+=4}{'J','X'-contains$_}{$s+=8}{'Q','Z'-contains$_}{$s+=10}{'K'-contains$_}{$s+=5}}}
$s

You can remove the string $s=0. The -in is sorter than -contains. switch can returns a value $s+=$(switch($_){...{1}...{2}... ...{5}}). and etc :) Welcome!

Thank you :D !!! I'm not very experienced in Code golfing so can you explain me what you did in your Code?

Step 1: obvious thing 240 bytes

Step 2: big case to default 195 bytes

Step 3: to take out repeating code 171 bytes

Step 4: replace .ToCharArray() with shortcut 163 bytes

Step 5: use switch with regexp instead long expressions with char array 92 bytes from Gabriel Mills :)

I will be happy to delete my answer if and when you choose to implement my 92 byte strategy, as @mazzy mentioned.

x86-machine code, IBM PC DOS, 37 bytes
00000000: bb18 0133 d2ac 2c41 d0e8 9cd7 d410 9d72  ...3..,A.......r
00000010: 0286 e002 d0e2 eec3 1332 1424 1851 3113  .........2.$.Q1.
00000020: a111 1448 4a                             ...HJ

Listing:
BB 0118     MOV  BX, OFFSET TBL     ; load score table into BX
33 D2       XOR  DX, DX             ; clear letter count
        LOOP_LETTER:
AC          LODSB                   ; load next char from DS:SI into AL, advance SI
2C 41       SUB  AL, 'A'            ; convert letter to zero-based index
D0 E8       SHR  AL, 1              ; divide index by 2, set CF if odd index
9C          PUSHF                   ; save CF
D7          XLAT                    ; AL = packed score byte
D4 10       AAM  16                 ; unpack nibbles into AH/AL (clobbers CF though)
9D          POPF                    ; restore CF
72 02       JC   ODD                ; if odd index, use low nibble
86 E0       XCHG AH, AL             ; otherwise is even, use high nibble
        ODD:
02 D0       ADD  DL, AL             ; add tile to score
E2 EE       LOOP LOOP_LETTER        ; loop through all letters
C3          RET                     ; return to caller
        TBL:
            DB 013H,032H,014H,024H,018H,051H,031H,013H,0A1H,011H,014H,048H,04AH

Try it online!
Note: using link above, re-run with input on command line like ASM ABC, etc.
As a callable function, input string at [SI], length in CX. Output to DX.
Explanation
Uses a score table of 4-bit nibbles for each tile's score. Loops through the input string and converts each letter to a zero-based index. Each index is divided by two to find the corresponding byte in the table. The low nibble is added if the index is odd, otherwise the high nibble is added if the index is even.
Test Program I/O

Use a different BX so no need to sub al, 'A'

brainfuck, 386 382 bytes
->,[>>,]->+>>+++>>+++>>++>>+>>++++>>++>>++++>>+>>++++++++>>+++++>>+>>+++>>+>>+>>+++>>++++++++++>>+>>+>>+>>+>>++++>>++++>>++++++++>>++++>>+++++++++++[-<<+]->+[->++++++++[<-------->-]<-[[->+]>>-<+[-<+]->]+[->+]->[->+>[>>]>++[-<+]->]>[-<+>]<<+<[<<]>-<+[-<+]>>->+]>[>>]>>+[[-]<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->[-]>>+>+<<<]]]]]]]]]<]>>[>]++++++[-<++++++++>]>>]<<<[.[-]<<<]

Try it online!
Pretty much ungolfed, but first brainfuck code for this question. This code can only handle uppercase letters. Any other symbol will lead to an endless loop. Also the maximum score depends on the used bf-interpreter. On tio.run this can handle scores up to 254.
points:
abcde fghij klmno pqrst uvwxyz
13321 42418 51311 3x111 14484x (x = 10)

tape:
[input], 0, [points table], 0, 0, score
input: current letter marker (0 or neg 1), current letter
points table: check letter marker (0 or neg 1), points

code:
-           set current letter marker
>,[>>,]     input characters

->          set check letter marker
            fill points table
+>>+++>>+++>>++>>+>>
++++>>++>>++++>>+>>++++++++>>
+++++>>+>>+++>>+>>+>>
+++>>++++++++++>>+>>+>>+>>
+>>++++>>++++>>++++++++>>++++>>++++++++++

+[-<<+]->                   go to first input letter
+                           bugfix: intersecting pointers
[                       main loop
  -                         bugfix: intersecting pointers
  >++++++++[<-------->-]<-  subtract 65 from current letter (ASCII A)
  [                         check loop: mark the entry in points table that's related to the current letter
    [->+]                   decrease letter and go to check letter marker
    >>-                     set new check letter marker
    <+[-<+]-                go back to current letter marker
    >                       go to current letter
  ]
                            the related points entry is found so we need to add the points to the score
  +[->+]->                  go to related points entry
  [                     addition loop
    ->+                     decrease points entry and save points to temporary cell
    >[>>]>+                 go to score and add 1
    +[-<+]->                go back to related points entry
  ]
  >[-<+>]                   move points back from temp cell
  <<+                       delete "check letter marker"
  <[<<]>-                   set "check letter marker" at A
  <+[-<+]                   go to current letter marker
  >>-                       set new current letter marker
  >                         next input letter
  +                         exit loop if cell pointer is at "check letter marker" position
]

>[>>]>                      go to score
                            number printing routine from esolangs
>+[[-]<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->+<[->[-]>>+>+<<<]]]]]]]]]<]>>[>]++++++[-<++++++++>]>>]<<<[.[-]<<<]

if unary output is allowed then this 297 293 bytes code can be used:
->,[>>,]->+>>+++>>+++>>++>>+>>++++>>++>>++++>>+>>++++++++>>+++++>>+>>+++>>+>>+>>+++>>++++++++++>>+>>+>>+>>+>>++++>>++++>>++++++++>>++++>>+++++++++++[-<<+]->+[->++++++++[<-------->-]<-[[->+]>>-<+[-<+]->]+[->+]->[->+>[>>]>++[-<+]->]>[-<+>]<<+<[<<]>-<+[-<+]>>->+]>[>>]<+++++++[>+++++++<-]>>[-<.>]

Try it online!

SNOBOL4 (CSNOBOL4), 224 bytes
	V =ARRAY(10,0)
	V<1> ='EAIONRTLSU'
	V<2> ='DG'
	V<3> ='BCMP'
	V<5> ='FHVWY'
	V<8> ='JX'
	V<10> ='QZ'
	I =INPUT
N	S =I
	X =LT(X,10) X + 1	:F(O)
R	S ANY(V<X>) =	:S(R)
	O =O + X * (SIZE(I) - SIZE(S))
	I =S	:(N)
O	OUTPUT =O
END

Try it online!
Very naive approach. Stores the letters in an ARRAY with indices equal to the scores. It tries to match 0 for point values that don't exist, which ends in a score of 0.
	V =ARRAY(10,0)			;* set up value array of 10 values with contents all 0
	V<1> ='EAIONRTLSU'		;* set contents at appropriate indices
	V<2> ='DG'
	V<3> ='BCMP'
	V<5> ='FHVWY'
	V<8> ='JX'
	V<10> ='QZ'
	I =INPUT			;* read input
N	S =I				;* begin Next iteration
	X =LT(X,10)	X + 1	:F(O)	;* increment X or GOTO output
R	S ANY(V<X>) =	:S(R)		;* replace ANY letters in V<X> with nothing
	O =O + X * (SIZE(I) - SIZE(S))	;* add to the score
	I =S	:(N)			;* set I to S and goto N
O	OUTPUT =O
END

Rockstar, 187 184 156 154 bytes
listen to W
cut W in S
cut W
while W
roll W in X
P's 1
cut "DG1BCMP1FHVWY1K111JX11QZ" in T
while T
roll T in L
let P be+L's 1
let S be+L's X and P

say S

Try it here (Code will need to be pasted in)
Abuses a nice little feature in Rockstar whereby the variable (S in this case) an array is assigned to can be used to reference both the array (e.g., S at index) or, by itself, the length of the array. So, by cutting the input Word into the array S we, straight away, have a base score of 1 point per letter.
listen to W        :Read input into variable W
cut W in S         :Split W into variable S (our score)
cut W              :Split W
while W            :While W is not empty
roll W in X        :  Pop first element of W into variable X
P's 1              :  Initialise P as 1 (base score for each tile)
cut "..." in T     :  Split "DG1BCMP1FHVWY1K111JX11QZ" into variable T
while T            :  While T is not empty
roll T in L        :    Pop first element of T into variable L
let P be+          :    Increment P by
  L's 1            :      Is L equal to 1?
let S be           :    Increment S by
  L's X            :      Is L equal to X?
  and P            :      Logical AND with P
                   :  End while loop
                   :End while loop
say S              :Output S

Thunno 2 S, 20 bytes
Ä⁻»yŒṄȦẏÄb¶Ỵɓæ»11Bsi

Attempt This Online!
Explanation
Ä⁻»yŒṄȦẏÄb¶Ỵɓæ»11Bsi  # Implicit input
Ä⁻                    # Convert input to 0-based indices in alphabet
  »yŒṄȦẏÄb¶Ỵɓæ»       # Compressed integer 140755590392038037755694497
               11B    # Converted to base 11 as a list:
                      # [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10]
                      # (A, B, C, D, E, ...)
                  si  # Index into the list
                      # Implicit output of the sum

Vyxal rs, 20 bytes
øA11»⟑↑Gp→₃ꜝ¬∑"Ż¶»τİ

Try it Online!
port of thunno 2 answer but I needed an extra byte for the compressed number since vyxal cant zero index letters to numbers

flagless 20

Visual Basic for Applications, 117 bytes
s=inputbox(u):for i=1to 16:s=replace(s,mid("DGBCMPFHVWYKJXQZ",i,1),space(mid("1122223333347799",i,1)+1)):next:?len(s)

Run in immediate (debug) window.

PHP, 74 bytes
while($c=$argn[$i++])$s+=1+_02210313074020029000033739[ord($c)&31];echo$s;

case insensitive. Run as pipe with -nR or try it online.

C# (.NET Core), 48 + 18 = 66 bytes
s=>s.Sum(c=>"!#C²!$1$$XhQJ"[c%13]-16>>c%2*4&15)

+18 bytes is for using System.Linq;
Try it online!

Isnt the function signature part of the code?

@KristofferSall-Storgaard I'm not actually sure on the code golf rules since I don't post often. I just mimicked TheLethalCoder's setup and tried to save a few bytes.

I was wrong. It would appear we dont need to name the functions

T-SQL, 106 bytes
Accepting uppercase characters.
Inserted a line break to make this readable:
DECLARE @ varchar(max)='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

WHILE'='<@
SET
@=stuff(@,1,1,'')+'-~'+substring('02210313074020029000033739',ascii(@)-64,1)
EXEC('print'+@)

Julia 1.0, 49 bytes
!x=sum(i->b"\1\3\3\2\1\4\2\4\1\b\5\1\3\1\1\3\n\1\1\1\1\4\4\b\4\n"[i-'@'],x)

(the special characters are escaped here for clarity)
Try it online!


text:
Autogram programs
This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z.
Such sentences are called autograms. Your task is to write a program or function that has a similar property: it takes as input a byte, and outputs an integer representing the number of times that byte appears in the program's source code. It should output 0 if its input doesn't appear in its source.
Your program must not read its own source code, directly or indirectly, but instead all the data it needs to give its output must be hard-coded, quine style. Your program must be at least one byte in length.
This is code-golf, so the shortest entry (in bytes) wins. I won't accept an answer, so feel free to compete for the shortest solution in your favourite language.
You are strongly encouraged to include an explanation in your post.
Leaderboards
Below are leaderboards both for overall score and per language:

var QUESTION_ID=162408,OVERRIDE_USER=21034;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Sandbox. (It's been in there since 2014!)

Are functions allowed, or only full programs?

@Uriel functions are allowed. (I added it to the question.)

Does the proper quine rules apply here? (IIRC ais523's "there must be a part of a program that encodes both itself and something else") Is the Retina submission valid?

@user202729 thank you for asking for clarification, but the challenge actually says that quine rules apply, so I've deleted my answer

Note: Answers similar to this one doesn't count as valid anymore.

FWIW, the proper quine definition is a bit stronger than I would really like for this challenge. For example, I would be quite happy to see a program that uses all the characters in some contiguous range, and just outputs a 1 if its input is in that range, even though this doesn't have "a section of the program which encodes a different part of the program". For that reason I'd have been willing to allow the retina example, though it would have been disappointing if it had put others off from posting, due to already just being 1 byte. (@user202729)

Because of my above comment, I've removed the statement that quine rules apply. (I've kept the part about not reading the source code.)

what do you think about https://codegolf.stackexchange.com/questions/162408/autogram-programs#comment394602_162429 ?

I gave up on it: https://tio.run/##HY5NCoMwEIX3nuJRcoFqo9CrmC4kCxHUhCRdSc6efpbhmz@G96b4vbWYglckrlzSdq46FvqoUUmDgnp5cJIlX6wyY4ENTljhgOU@c7JylSvD9ATyi3HUne2/GzSprzKxtv0285r3HFLR1UVMA4sHkXHZcOAjtLFGHOlbdEDNojTJdPXDt9@SZfzbaY7UT@1a@wE

Octave, 44 bytes
@(x)sum([[39,'(())*,239==@[[]]msuxx']]==x)*2

Try it online!
The result of the function, when using each of the characters in the function as input:
'  (  )  *  ,  2  3  9  =  @  [  ]  m  s  u  x
2  4  4  2  2  2  2  2  4  2  4  4  2  2  2  4

All other input characters returns a zero.
The fact that I had to escape ' made this a whole lot longer. In order to account for the 4 parentheses, I just had a duplicate in the string. However, duplicating apostrophes takes apostrophes, so this just takes us further from the correct result. Therefore, I had to count the number of apostrophes with its ASCII-value, 39. This of course meant I had to check for the characters 3 and 9 too, making it all a lot longer.

This is the sort of thing I'm hoping to see more of. (Optimising for the problem, rather than just taking a standard quine and adding code to count the characters.)

Excel, 84 bytes
=IFERROR(MID("65496331125442343343233",FIND(A1,"""123456789,()=MINORFADEOMEN"),1),0)

Find() will look for the value in cell A1 within the string "123456789,()=MINORFADEOMEN (the """ at the beginning is to escape the character and will evaluate to just ").
Based on the result of Find(), the Mid() function will return the corresponding character from the string of numbers. This string was created through iteration until it stopped changing.
If the character in A1 is not found, Find() returns an error so the IfError() function escapes that to return 0 instead.
The OMEN at the end of the string being searched in the Find() function are duplicate letters so their position will never be returned but they were needed to adjust the character counts. Without them, there was an endless loop of changing counts. The letter arrangement is stylistic choice.

Retina, 1 byte
This wouldn't be valid if following strictly the quine rules, but the OP explicitely allowed it in a comment.
x

Try it online!
In retina a single-line program counts the occurrences of that regex in the input. This challenge is solved by any single ASCII character except `, ., +, *, ?, [, (, ), ^, $, \ and newline.

JavaScript (ES6), 70 bytes
Doesn't read the source of the function, but this is quite long. Takes input as a 1-character string.
i=>~(n='\\34=\'in(|)0257?:.>[]Odefx~'.indexOf(i))?'3733544333'[n]||2:0

Try it online!

You can shorten this a bunch by reworking a bit to lower the amount of distinct characters: i=>'36335633'[i='\\36=\'i|&()25.>[]Odefx~n'.indexOf(i)]||~i&&2 (8 bytes saved)

C# (Visual C# Compiler), 88 57 bytes
x=>"\\\"(())==>>??..::3300CCaaiinoossttx".Contains(x)?3:0

Try it online!
Returns 3 if the string contains the passed char, otherwise returns 0.
The string contains each character of the code atleast once and exactly the amount required to have the char 3 times in the code.
-31 bytes thanks to Kevin Cruijssen

Nice approach! +1 from me. You can save some bytes by removing the parenthesis around (a)=> and taking the input as string instead of char so the .ToString() is no longer necessary (and a+"" could have been used as well, for code-golf challenges you'll never need .ToString()). Also, since .Contains already contains an a, you might make the input-variable a different unused character (like x or q) to have 3 for each character instead of 4. EDIT: Never mind the last part, I see " is used 4 times as well now.

@KevinCruijssen Thanks for the advice. But is string valid as input? Considering OP asked for a byte as input?

As long as it's a single character string I'm pretty sure it is. Most languages can only input string-values anyway, and some that have characters still choose to input as string (like the Java, JavaScript, and Japt for example. Input and output formats are usually pretty flexible. But you could always ask OP in a comment if you're still doubting. :)

@KevinCruijssen sounds reasonable. And if we escape one of the " we can even get down to the desired 3 per char

Single character strings as input are fine by me.

@Hyarus Ah smart with the \\\" indeed. Oh, and welcome to PPCG! I see you're still relatively new here.

Haskell, 66 bytes
The first two versions are essentially a quine which filters the required characters and then takes the length:
q c=length.filter(==c)$id<>show$"q c=length.filter(==c)$id<>show$"

Try it online or test with all characters!*

Alternative without (<>), 72 bytes
q c=length.filter(==c)$(++)<*>show$"q c=length.filter(==c)$(++)<*>show$"

Try it online or test with all characters!

Non-quine alternative, 87 86 bytes
Might still be improved, but I'm happy that I got it down to only three different groups.
I like this one the best, even though it counts the most bytes. It's computes the character/byte count by as a sum of 2,3 and 7 (note how some characters are in multiple groups):
u t=sum[fst e|e<-[(2," ()-237<=dflnst|"),(3," ()[\\]`mstu"),(7,"\",ee")],t`elem`snd e]

Try it online or test with all characters!

* imports (<>) because TIO's GHC version is 8.0.2

Java 10, 164 81 57 bytes
q->"q-->>\\\"..ccoonttaaiiss(())??33::00".contains(q)?3:0

Port of @Hyarus' C# answer, so make sure to upvote him!
Explanation:
Try it online.
q->      // Method with String parameter and integer return-type
  "q->\\\"..ccoonttaaiiss(())??33::00".contains(q)?
         //  If the string above contains the input character
   3     //   Return 3
  :      //  Else:
   0     //   Return 0

Old quine 164-bytes answer:
c->{var s="c->{var s=%c%s%1$c;return s.format(s,34,s).replaceAll(%1$c[^%1$c+c+']',%1$c%1$c).length();}";return s.format(s,34,s).replaceAll("[^"+c+']',"").length();}

Explanation:
Try it online.
c->{                                  // Method with char parameter and integer return-type
  var s="c->{var s=%c%s%1$c;return s.format(s,34,s).replaceAll(%1$c[^%1$c+c+']',%1$c%1$c).length();}";
                                      //  Unformatted source code
  return s.format(s,34,s)             //  Create the formatted source code (the quine),
          .replaceAll("[^"+c+']',"")  //  remove all characters not equal to the input,
          .length();}                 //  and return the length

quine-part:

The String s contains the unformatted source code.
%s is used to input this String into itself with the s.format(...).
%c, %1$c and the 34 are used to format the double-quotes.
s.format(s,34,s) puts it all together

Challenge part:

.replaceAll("[^"+c+']',"") removes all characters except those equal to the input.
.length() then takes the length of this String.

NOTE: .split(c).length (with String input instead of char) may seem shorter, but has two problems:

The first character gives an incorrectly result, so if c (with c-> as leading part) is input, it will incorrectly return one character too few. This can be fixed by adding +(c==99?1:0) in both the source code and unformatted source code String (and changing .split(c) to .split(c+""), but then we still have the following problem:
If a regex character (i.e. $) is input, the .split will interpret it as a regex, giving an incorrect result.

Husk, 11 10 8 bytes
Thanks Leo for -2 bytes!
#sD"#sD"

Try it online!
Explanation
This makes sure that it only uses ASCII (because show would mess it up) and that each character is contained twice:
#sD"#sD"  -- character as input, eg. '"'
   "#sD"  -- string literal (note the redundant '"'): "#sD"
  D       -- double: "#sD#sD"
 s        -- show: "\"#sD#sD\""
#         -- number of occurences: 2

Standard quine extension, 11 bytes
#hS+s"#hS+s

Try it online!
Explanation
#hS+s"#hS+s  -- character as input, eg. '"'
     "#hS+s  -- string literal: "#hS+s"
  S+         -- join with itself: ("#hS+s"++)
    s        -- | and itself shown: "\"#hS+s\""
             -- : "#hS+s\"#hS+s\""
 h           -- init: "#hS+s\"#hS+s"
#            -- number of occurences in string: 1

You can manage the quotes more easily by doubling the string before showing it: Try it online!

Python 2, 54 52 32 bytes
-20 bytes thanks to ovs
("''+.23cnotu()"*2+'"*'*3).count

Try it online!

How come you don't have either lambda or input?

@StewieGriffin Python automatically binds a method reference, so "xxx".count is equivalent to lambda c:"xxx".count(c).

@StewieGriffin and you use both in the same way ->f="xxx".count and f=lambda c:"xxx".count(c) will be called as f('a')

Haskell, 58 bytes
f c=sum[2|x<-succ '!':"f c=sum[2|x<-succ '!':,x==c]",x==c]

Try it online! or verify the solution.
Same byte count alternatives:
f c=sum[2|x<-tail$show"f c=sum[2|x<-tail$show,x==c]",x==c]
f c=sum[1|x<-id<>show$"f c=sum[1|x<-id<>show$,x==c]",x==c]

Haskell, 90 bytes
sum.($zip"1234\"$,.[\\]opu+()iklmsz652"$[4,4,11,3,3,3,16,5,3,3,3,3,3,3,3]++[2,2..]).lookup

Try it online! or verify the solution. Uses the fact that sum Nothing = 0 and e.g. sum (Just 4) = 4.

Smalltalk, 112 132 bytes
Smalltalk isn't exactly known for its golfing suitability :-)
Method defined in class Character (tested in VA Smalltalk and Squeak, should work in other dialects such as VisualWorks and Pharo as well):
a^(0to:6),#(10 18)at:(#('' ',[]^|+68cForu' '#0adefln' '1it' '()' ':s' ' ' '''')findFirst:[:s|s includes:self])+1

Characters occurring in the source are grouped by occurrence count. The groups are tested for the first one which contains the receiver, and the matching occurrence count is returned.
Old method:
a^('''''((((())))):::[[[[]]]]^^^^^0000066666aaaacccccdddddeefffFFFFFiiilllnnnnnrrrrrsssTTTTTuuuu'includes:self)ifTrue:[6]ifFalse:[0]

Every character that does appear in the method appears exactly 6 times (by being repeated in the string constant), so the method just checks whether the receiver is contained in the string and returns 6 if it is, 0 otherwise.
After defining the method as above, you can validate it using
| code |
code := Character sourceCodeAt: #a.
((0 to: 255) collect: [:b | b asCharacter]) reject: [:c | c a = (code occurrencesOf: c)]

The result should be empty.

Welcome to PPCG!

JavaScript, 31 bytes
f=c=>~-`f=${f}`.split(c).length

Try it online

I think this reads its own source code, doesn't it? That's explicitly banned, in bold, in the question.

@Nathaniel, see here.

Hmm. Well honestly I think that's stupid, but I can't really disagree with meta consensus I suppose.

@Nathaniel For all programs that make eval easy, they also make quine easy.

@user202729 I don't think that follows, does it? You can't do the same trick in Python, for example. This is a reverse eval, not an eval

"but I can't really disagree with meta consensus I suppose." - @Nathaniel, you can downvote the meta answer if you so choose.

@Shaggy I've done so, of course.

@Nathaniel Somewhat. s='...';exec(s). Just the boilerplate is longer, the method is not harder at all..

@user202729 maybe I'm being dense, but I can't see how that helps write a quine. You still have to put the print command inside the quotes, and you still have to escape the quotes inside the print command, and do some trick to substitute the code inside of them. Basically you have to put a quine inside the quotes, and the exec is just an intron. Am I missing something?

@Nathaniel Using a string instead of a function, you could do f="q=unescape`%22`;g=c=>(q+f+q+'f=;eval(f)').split(c).length-1";eval(f), which creates a named function g. The only real differences are the code required to add quotes and the need to use eval(f).

Or more golfed: f="g=c=>(unescape`f=%22%22;eval(f)`+f).split(c).length-1";eval(f)

I don't understand. What's the difference between reading the source code of a function, and reading the source code of a string? If this is cheating, then reading a string should also be cheating.

@alephalpha Writing a proper defintion of quine is hard, finding loopholes in such definitions is easy.

Python 2, 57 bytes
lambda c,s='lambda c,s=%r:(s%%s).count(c)':(s%s).count(c)

Try it online!

05AB1E, 17 bytes
2"D34çýs¢"D34çýs¢

Try it online!

x86 .COM, 17 bytes, controversial
0120 BF2001        MOV     DI,0120 (120 be the current address)
0123 B91100        MOV     CX,0011
0126 AE            SCASB
0127 7502          JNZ     012B
0129 FEC4          INC     AH
012B E2F9          LOOP    0126
012D C1E808        SHR     AX,8
0130 C3            RET

36 bytes
0100 BF????        MOV     DI,(an copy of this code)
0103 B91200        MOV     CX,0012
0106 AE            SCASB
0107 7503          JNZ     010C
0109 80C402        ADD     AH,02
010C E2F8          LOOP    0106
010E C1E808        SHR     AX,8
0111 C3            RET

Isn't this reading it's own code?

@RazvanSocol I think it's like the JavaScript solution

@RazvanSocol well it doesn't require saving in a file so it's okay. a lot of fungeoids and JS also do this

I argue you are reading code that is executed, which counts as "reading own source code". Now you could argue having a string copy of the program, as most solutions here do, is also "reading source code", but the string isn't executed.

Haskell, 96 bytes
n"n"=15;n"="=14;n" "=2;n";"=13;n"\\"=3;n"\""=25;n"0"=2;n"1"=4;n"2"=4;n"3"=4;n"4"=5;n"5"=5;n n3=0

Try it online!
Haskell, 109 bytes
n 'n'=15;n '='=14;n ' '=14;n ';'=13;n '\\'=3;n '\''=25;n '0'=2;n '1'=5;n '2'=4;n '3'=4;n '4'=5;n '5'=5;n n3=0

Try it online!
Haskell, 122 bytes
n 'n'=21
n '='=14
n ' '=14
n '\n'=12
n '\\'=4
n '\''=32
n '0'=2
n '1'=5
n '2'=5
n '3'=3
n '4'=5
n '5'=5
n nnnnnn4'''''''=0

Try it online!
Explanations
These answers are not terribly sophisticated.  It is a series of declarations, one for each character present in the program.  At the end we have a catch all that returns 0 for characters not present in the program.
I use a couple of tricks to minimize the number of characters necessary in the program and from there I fiddled with things until the numbers turned out just right.  You can see that I've padded the variable name in the last declaration, in all 3 of them.  The difference between the 3 programs is whether I chose to use a new line or ; for line breaks and whether I chose to take Chars as input or Strings.  The ; approach doesn't seem inherently superior to the others it just gets luck and ends up shorter, however it does seem that using Strings is a better idea than Chars because Chars require spaces after the function name an Strings do not.

:| what happened to your spelling in the explanation

Whitespace, 140 bytes
[S S S N
_Push_0][S N
S _Duplicate][S N
S _Duplicate][T N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve][S S S T  S S T   N
_Push_9][T  S S T   _Subtract][S N
S _Duplicate][N
T   S S T   N
_If_0_Jump_to_Label_TAB][S S S T    N
_Push_1][T  S S T   _Subtract][S N
S _Duplicate][N
T   S S N
_If_0_Jump_to_Label_NEWLINE][S S S T    S T T   S N
_Push_22][T S S T   _Subtract][N
T   S T N
_If_0_Jump_to_Label_SPACE][N
S T N
_Jump_to_Label_PRINT][N
S S S T N
_Create_Label_TAB][S S S T  S S T   S T N
_Push_37][N
S T N
_Jump_to_Label_PRINT][N
S S S N
_Create_Label_NEWLINE][S S S T  S S S S T   N
_Push_33][N
S T N
_Jump_to_Label_PRINT][N
S S T   N
_Create_Label_SPACE][S S S T    S S S T T   S N
_Push_70][N
S S N
_Create_Label_PRINT][T  N
S T _Print_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
70 spaces, 37 tabs, and 33 new-lines used.
Usually I use the Create Labels in the order NSSN, NSSSN, NSSTN, NSSSSN, NSSSTN, NSSTSN, NSSTTN, etc. But because printing a number where the binary S=0/T=1 is used affects the number I need to output, I used the labels NSSN, NSSSN, NSSTN, and NSSSTN instead, which gave the perfect amount of spaces/tabs to be printed with the binary numbers SSSTSSSSTN (33; amount of new-lines), SSSTSSTSTN (37; amount of tabs), and SSSTSSSTTSN (70; amount of spaces).
Explanation in pseudo-code:
Character c = STDIN-input as character
If c is a tab:
  Print 37
Else if c is a new-line:
  Print 33
Else if c is a space:
  Print 70
Else
  Print 0

Example runs:
Input: space
Command       Explanation                   Stack       Heap     STDIN   STDOUT   STDERR

SSSN          Push 0                        [0]
SNS           Duplicate top (0)             [0,0]
SNS           Duplicate top (0)             [0,0,0]
TNTS          Read STDIN as character       [0,0]       {0:32}   \n
TTT           Retrieve                      [0,32]      {0:32}
SSSTSSTN      Push 9                        [0,32,9]    {0:32}
TSST          Subtract top two (32-9)       [0,23]      {0:32}
SNS           Duplicate top (23)            [0,23,23]   {0:32}
NTSSTN        If 0: Jump to Label_TAB       [0,23]      {0:32}
SSSTN         Push 1                        [0,23,1]    {0:32}
TSST          Subtract top two (23-1)       [0,22]      {0:32}
SNS           Duplicate top (22)            [0,22,22]   {0:32}
NTSSN         If 0: Jump to Label_NEWLINE   [0,22]      {0:32}
SSSTSTTSN     Push 22                       [0,22,22]   {0:32}
TSST          Subtract top two (22-22)      [0,0]       {0:32}
NTSTN         If 0: Jump to Label_SPACE     [0]         {0:32}
NSSTN         Create Label_SPACE            [0]         {0:32}
SSSTSSSTTSN   Push 70                       [0,70]      {0:32}
NSTN          Jump to Label_PRINT           [0,70]      {0:32}
NSSN          Create Label_PRINT            [0,70]      {0:32}
TNST          Print as integer              [0]         {0:32}            70
                                                                                error

Program stops with an error: No exit defined.
Try it online (with raw spaces, tabs, and new-lines only).
Input: tab
STDIN will be \t (9) instead, in which case it will be 0 at the first If 0 check, goes to LABEL_TAB/NSSSTN, and will push and print 37 instead.
Try it online (with raw spaces, tabs, and new-lines only).
Input: new-line
STDIN will be \n (10) instead, in which case it will be 0 at the second If 0 check, goes to Label_NEWLINE/NSSSN, and will push and print 33 instead.
Try it online (with raw spaces, tabs, and new-lines only).
Input: anything else
Any other input-character will do NSTN (Jump to Label_PRINT) after the third If 0 check, printing the 0 that was still on the stack (which we've duplicated at the very beginning).
Try it online (with raw spaces, tabs, and new-lines only).

This is a great language for this challenge.

Japt, 27 bytes
\Ua"" a a a " ÄU\\\"a "aU Ä
            " ÄU\\\"a "     // Given this string literal,
                       aU   // find the last index of the input
                          Ä // and add +1.
\Ua"" a a a                 // Do nothing useful, but make the results match.

Longer than the existing Japt answer, but uses a different approach.
Has the inherent limitation that all chars need to occur a unique number of times.
Takes input as a string.
Try it online!

Perl, 130 bytes
+print+0+((0)x40,6,6,0,3,43,0,0,0,22,12,6,3,5,2,4,0,1,0,0,0,1,0,1,(0)x28,1,0,1,(0)x6,1,(0)x4,1,(0)x4,1,1,1,0,2,0,1,0,0,0,5)[ord<>]

Has no newline or other whitespace.  Reads a line from the standard output, but only cares about its first bytes, then prints the number of times that byte occurs in its own source code in decimal, without a newline.
The program is straightforward.  Most of the source code is occupied by a literal table that gives the answer for the each possible byte.  Trailing zeros are omitted, and adjacent zeros are run-time compressed, but there's no special trick other than that.  The rest of the program simply reads the input and looks up the answer in the table.
For example, the part 22, 12, 6, 3, 5, 2, 4, 0, 1, 0 in the source code gives the frequency of digits, so there are 22 zeroes, 12 ones, 6 twos etc in the source code.  As a result, if you enter 0 to the standard input of the program, the program will print 22.

C (gcc), 1033 bytes
#include <stdio.h>
int main(int argc,char *argv[]){int r=0*14811;switch((int)argv[1][0]){case' ':r=6;break;case'"':r=3;break;case'#':r=2;break;case'%':r=2;break;case'\'':r=101;break;case'(':r=5;break;case')':r=5;break;case'*':r=5*1*1;break;case'.':r=2;break;case':':r=51;break;case';':r=103;break;case'<':r=2;break;case'=':r=52;break;case'>':r=2;break;case'[':r=4;break;case'\\':r=3;break;case']':r=4;break;case'0':r=11;break;case'1':r=20;break;case'2':r=20;break;case'3':r=9;break;case'4':r=7;break;case'5':r=12;break;case'6':r=3;break;case'7':r=2;break;case'8':r=5;break;case'9':r=2;break;case'a':r=106;break;case'b':r=51;break;case'c':r=55;break;case'd':r=4;break;case'e':r=102;break;case'f':r=2;break;case'g':r=4;break;case'h':r=4;break;case'i':r=10;break;case'k':r=51;break;case'l':r=2;break;case'm':r=2;break;case'n':r=8;break;case'o':r=2;break;case'p':r=2;break;case'r':r=108;break;case's':r=53;break;case't':r=8;break;case'u':r=2;break;case'v':r=3;break;case'w':r=2;break;case'{':r=3;break;case'}':r=3;break;}printf("%d",r);}

Try it online!
This is by NO means a golfed answer, but it was fun to try to accomplish this challenge in a language which I am not familiar with. It wasn't a particularly difficult challenge until it came time to find the occurrences of the digits, now THAT was a challenge. Had to do a little creative balancing :)

C (gcc), 192 bytes
F(J){J=J-70?J-40?J-41?J-74?J-'{'?J-'}'?J-39?J-48?J-49?J-50?J-51?J-52?J-53?J-54?J-55?J-56?J-57?J-47?J-61?J-63?J-45?J-58?J-59?0:1:23:23:23:1:2:3:3:4:4:14:14:10:10:15:6:4:2:2:25:1:1:1;}//84332211

Try it online!
Probably possible to golf down further. Uses a comment at the end as a 'scratch space' to add extra digits. When I have to change a digit from X to Y, I change one of the Y's in the scratch to an X to compensate. Other than that this is just a function that takes an integer, using the assignment trick to return a value based on a large ternary conditional.

I can save 1 byte by moving the numeric constant to after the zero as 0*84332211 like in the other C answer, but I can also save bytes by refactoring that to be smaller, so I'm not going to bother just yet.

Can you save bytes by using a range check for the less common numbers? that is if we assme 4-9 are rare characters, we can handle them all at once with a conditional check.

Almost certainly. We could probably remove even more by picking clever names for things so that certain symbols never appear or so that the bit-patterns can be used (e.g. J&1? to match all odd characters). I may further golf this if I find the time to do so.

APL (Dyalog Classic), 30 bytes
⊢⊢⊢11-11-11-'''''''1''⊢-⍳⍳0'⍳⊢

Try it online!
Explanation
In APL, single quotes within strings are escaped by doubling, so '''''''1''⊢-⍳⍳0' is the string '''1'⊢-⍳⍳0, which contain every character used in the program.
APL arrays are by default 1-indexed, and the index-of function, interestingly, returns 1 + max index if the element is not found.
So, by using index-of on the string and the input returns
Input    Index    Count
'        1        10
1        4        7
⊢        6        5
-        7        4
⍳        8        3
0        10       1
<other>  11       0

As one can see, 11 - index gives the count of the character in the program. So, the basic algorithm is
11-'''''''1''⊢-⍳⍳0'⍳⊢

The rest is bloating the character counts to allow them to fit nicely into the slots.

Japt, 14 bytes
Qi"QiUè² " ²èU

Try it

Explanation
                   :Implicit input of character string U
  "QiUè² "         :String literal
Qi                 :Append a quotation mark
           ²       :Repeat twice
            èU     :Count the occurrences of U

V, 12 bytes
ñéÑ~"qpxøÖa

Try it online!
Hexdump:
00000000: f1e9 d17e 2271 7078 f8d6 1261            ...~"qpx...a

x86, 42 40 bytes
Here I use the same strategy as others: Create a string copy of the program with unique bytes, then return 2 in al if the input al is in the string. If we allow ourselves to read code that is actually run, we get l4m2's solution.
I got to make use of a cool string instruction scasb. To the best of my knowledge, there are no duplicate bytes, but this is something I'd easily screw up. Loading the string address takes 5 bytes but I'm not aware of any shorter solution (64-bit lea of rip with offset takes 6 bytes).
-2 by jumping backwards to avoid using 02 twice.
.section .text
.globl main
main:
        mov     $0xff, %eax

start:
        push    $20             # program length
        pop     %ecx            # counter
        mov     $str, %edi      # load string

loop:
        scasb                   # if (al == *(edi++))
        jne     loop1
        mov     $2, %al         # ret 2
end:    ret
loop1:
        loop    loop            # do while (--counter)
        xor     %eax, %eax      # ret 0
        jmp     end

str:    .byte 0x6a,0x14,0x59,0xbf,0xf4,0x83,0x04,0x08
        .byte 0xae,0x75,0x03,0xb0,0x02,0xc3,0xe2,0xf8
        .byte 0x31,0xc0,0xeb,0xf9

Hexdump (of binary file format elf32-i386, as obj file unfortunately has 00 bytes for str address):
000003e0  6a 14 59 bf f4 83 04 08  ae 75 03 b0 02 c3 e2 f8  |j.Y......u......|
000003f0  31 c0 eb f9 6a 14 59 bf  f4 83 04 08 ae 75 03 b0  |1...j.Y......u..|
00000400  02 c3 e2 f8 31 c0 eb f9                           |....1...|

x86, 256 bytes
Boring answer that is the equivalent of a giant comment. Input in cl, immediately returns 1 in al. I'll make an actual answer when I have the free time.
00000039  b0 01 c3 00 02 03 04 05  06 07 08 09 0a 0b 0c 0d  |................|
00000049  0e 0f 10 11 12 13 14 15  16 17 18 19 1a 1b 1c 1d  |................|
00000059  1e 1f 20 21 22 23 24 25  26 27 28 29 2a 2b 2c 2d  |.. !"#$%&'()*+,-|
00000069  2e 2f 30 31 32 33 34 35  36 37 38 39 3a 3b 3c 3d  |./0123456789:;<=|
00000079  3e 3f 40 41 42 43 44 45  46 47 48 49 4a 4b 4c 4d  |>?@ABCDEFGHIJKLM|
00000089  4e 4f 50 51 52 53 54 55  56 57 58 59 5a 5b 5c 5d  |NOPQRSTUVWXYZ[\]|
00000099  5e 5f 60 61 62 63 64 65  66 67 68 69 6a 6b 6c 6d  |^_`abcdefghijklm|
000000a9  6e 6f 70 71 72 73 74 75  76 77 78 79 7a 7b 7c 7d  |nopqrstuvwxyz{|}|
000000b9  7e 7f 80 81 82 83 84 85  86 87 88 89 8a 8b 8c 8d  |~...............|
000000c9  8e 8f 90 91 92 93 94 95  96 97 98 99 9a 9b 9c 9d  |................|
000000d9  9e 9f a0 a1 a2 a3 a4 a5  a6 a7 a8 a9 aa ab ac ad  |................|
000000e9  ae af b1 b2 b3 b4 b5 b6  b7 b8 b9 ba bb bc bd be  |................|
000000f9  bf c0 c1 c2 c4 c5 c6 c7  c8 c9 ca cb cc cd ce cf  |................|
00000109  d0 d1 d2 d3 d4 d5 d6 d7  d8 d9 da db dc dd de df  |................|
00000119  e0 e1 e2 e3 e4 e5 e6 e7  e8 e9 ea eb ec ed ee ef  |................|
00000129  f0 f1 f2 f3 f4 f5 f6 f7  f8 f9 fa fb fc fd fe ff  |................|

Jelly, 16 bytes
“;⁾w⁸a2”;⁾“”w⁸a2

Try it online!
Every character appears exactly twice.
“;⁾w⁸a2”;⁾“”w⁸a2
“;⁾w⁸a2”;⁾“”     the string ;⁾w⁸a2“”
            w⁸a2 return 2 if input in string

R, 135 bytes
Inspired by this Python answer.
Previous versions were broken. Thanks to @Giuseppe for pointing out that paste was not required it saved 18 bytes or so. lengths(regmatches(z,gregexpr(x,z)))is from this answer.
function(x,z=rep(c("afilo2679=:","hmpu15'","nstxz","cgr","e","()",'"',","),c(2:5,7,9,15,16)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online!

Pari/GP, 36 bytes
f=(x)->#[x|c<-Vec(Str("f=",f)),x==c]

Try it online!

Ruby, 48 bytes
->x{%q[->x{%q[].count(x.chr)*2}].count(x.chr)*2}

%q[str] is a more convenient way to write a string literal than "str" because it can be nested inside itself without any escaping. So I just put the entire code except for the copy inside it, then double the count.

Jelly, 12 10 bytes
“;Ṿċƈ”;Ṿċƈ

Try it online!
Reads a character from STDIN.
12 bytes
Ḣ“Ḣċ;Ṿ¤”;Ṿ¤ċ

Try it online!
Using input from command line argument.
Also 12 bytes:
ẇ“Ṿẇ¤Ḥ”Ṿ¤Ḥ“”

Try it online!

><>, 19 bytes
'0d3*{:}=+l2=?n$40.

Try it online!
Takes input via the -s flag. Uses the standard ><> quine format, counting how many occurrences of the character are present in the program.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Rotational Average
Given an input integer n >= 10, output the average of all deduplicated rotations of the integer.
For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two rotations). The average of those is (123 + 231 + 312) / 3 or 222.
As another example, take 4928. The rotations are 4928, 9284, 2849, and 8492. Taking the average of those four numbers equals 6388.25.
For another example, for input 445445, the deduplicated rotations are 445445, 454454, and 544544, so the output is 481481.
For input 777, there is only one deduplicated rotation, so the output is 777.
Rules

If applicable, you can assume that the input/output will fit in your language's native Integer type.
The input and output can be given by any convenient method.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Can we take input as a list of digits?

@Dennis Sure, that's fine. Go save some bytes. :p

Do you have an example where the deduplication actually changes the output ? In your 445445 example, each 3 unique rotation happens twice, so leaving them doesn't change the output.

@Kaldo No, I wasn't able to (manually) come up with one, but that doesn't mean one doesn't exist, so I left the deduplication rules in place.

@AdmBorkBork So we every answer should deduplicate rotations even though if they validate the examples without it ?

@Kaldo Let d be the number of digits of n and k the smallest positive integer such that rotating n k digits to the left reproduces n. Take q and 0 ≤ r < k such that d = qk + r. Rotating n both d and qk digits to the left must yield n, so r = 0. This means each unique rotation occurs q times, so deduplicating the rotations isn't needed to compute the average.

@Dennis lagrange theorem ^^

Taking input as a list of digits contradicts "If applicable, you can assume that the input/output will fit in your language's native Integer type.", right?

@RK. Well, the output won't fit anyway, since it usually isn't integer.

Python 3, 38 36 bytes
lambda*n:10**len(n)//9*sum(n)/len(n)

Takes the digits as separate arguments. Thanks to @Rod for suggesting Python 3, saving 2 bytes.
Try it online!

An additional byte could be saved by switching back to Python 2 and taking an array of floats.

You don't need to take the digits as separate arguments, a regular old list does just fine

APL (Dyalog), 9 bytes
10⊥≢⍴+/÷≢

A monadic function taking a vector of digits as an argument.
Try it online!
I take the average of the digits +/÷≢, then repeat it by the length of the input ≢⍴, and finally convert from base 10.
Conceptially, I am taking the sum of the rotations (without carrying):
 4  2  9  8
 2  9  8  4
 9  8  4  2
+8  4  2  9
 -----------
 23 23 23 23

This is just 4+2+9+8 repeated 4 times. Then converting from base 10 (which does the carrying for me)
 and dividing by the length. Although I divide by the length earlier on because it is equivilent and saves bytes.

That's genial :D

@Leo FWIW the answers that multiply the average by a rep digit are doing essentially the same thing

R, 84 73 64 bytes
function(D,K=sum(D|1))mean(array(D,K+1:0)[1:K,1:K]%*%10^(K:1-1))

Try it online!
Input as list of digits.
Thanks to MickyT for shaving off 11 bytes! 8 bytes shaved by Dennis' proof that deduplication is unnecessary.

With a slightly different way to rotate the number for 73

@MickyT aaahhh clever use of recycling!

@MickyT array(D,K+1:0) is shorter than matrix(D,K+1,K) by a byte.

Java 10, 163 137 76 72 71 bytes
n->(Math.pow(10,n.size())-1)/9*n.stream().mapToInt(i->i).sum()/n.size()

-36 bytes thanks to @Nevay.
-61 bytes thanks to @OlivierGrégoire by creating a port of @Dennis' Python 3 answer.
-1 bytes by taking the input as a List of digits instead of String.
Explanation:
Try it online.
n->                                 // Method with String parameter and double return-type
  (Math.pow(10,n.size())-1)/9       //  Repunits the same length as the input-size
  *n.stream().mapToInt(i->i).sum()  //  multiplied by the sum of digits
  /n.size()                         //  divided by the input-size

151 bytes: n->{var s=new java.util.HashSet();var r=0d;for(int l=n.length(),x;l-->0;)if(s.add(x=new Integer(n=n.substring(1)+n.charAt(0))))r+=x;return r/s.size();}, stream approach with 137 bytes: n->java.util.stream.IntStream.range(0,n.length()).map(i->new Integer(n.substring(i)+n.substring(0,i))).distinct().average().getAsDouble()

Use orElse(0) instead of getAsDouble().

69 bytes, based on others' solution. Round using (int) for 5 mote bytes, if needed.

You don't need to cast as a double: Math.pow already takes care of that. That'll spare you 3 bytes.

@OlivierGrégoire It will give incorrect results if I do that. The cast to int is used so we can integer-divide by 9 and multiply by the sum of digits. Only then it should a double to get the average. If I remove both (int) and *.1 it will for example output 6388.888... instead of 6388.25 for the input 4928. And if I cast the entire thing or just the .pow to an int instead, it will output 6388.

My bad: I was not thinking about the expected decimal values.

@OlivierGrégoire Ok, I was overthinking it. The 10^length/9 in Dennis' answer is used to calculate repunits, which is basically (10^length-1)/9. So the cast to int or *1. is no longer necessary.

Husk, 5 bytes
d´MKA

Try it online!
Explanation
d´MKA
    A  Take the average of the digits
 ´MK   Replace each element of the original list with the average
d      Join the list to get a number

Husk, 7 bytes
A§modṙŀ

Try it online!
Explanation
A§modṙŀ
      ŀ  Take the range [1..length(input)]
 §m  ṙ   Rotate the input by each element of the range
   od    Convert each list of digits to a number
A        Take the average of the list

For a puzzle, there is at least one 5 byte solution

@H.PWiz I can't figure it out, could you give out a hint? :P

@Leo There is no ṙ or ŀ, and the first character (on the left) is not A

Vyxal, 3 bytes
Ṗ⌊ṁ

-2 bytes thanks to @lyxal
Try it online!
Explanation
Ṗ   # Permutations
 ⌊  # Convert each to an integer
  ṁ # Mean

Try it Online! for 4 bytes, because ṅ vectorises when there's sublists

@Lyxal Oh yeah I just realised that a few days ago, thanks

Try it Online! for 3 bytes

Jelly, 6 5 bytes
ṙJḌÆm

Try it online!
How it works
ṙJḌÆm  Main link. Argument: A (digit array)

 J     Yield the indices of A, i.e., [1, ..., len(A)].
ṙ      Rotate A 1, ..., and len(A) units to the left, yielding a 2D array.
  Ḍ    Convert each rotation from decimal to integer.
   Æm  Take the arithmetic mean.

05AB1E, 9 bytes
vÀD}\OIg/

Try it online!

v with no y, interesting.

gFÀD})¨Osg/ was where I was thinking.

Do you know how to use the .æ  = pop a      compute permutations by function, usage: .æ<FUNC>} command yet? I don't either, but it seems fit to this.

@MagicOctopusUrn v without y is the shortest solution I could find to perform the rotation g(input) times.
I'm checking the .æ, doesn't seem like it's registering }

Stax, 6 bytes
ñJä⌠╤►

Run and debug it
This program takes a quote-delimited string as input, and expresses the average as a reduced fraction. e.g. 777/1  It's not necessary to de-duplicate the rotations.  It never changes the result.
Unpacked, ungolfed, and commented, it looks like this.
:)  get all character rotations
{em convert strings back to integers
:V  mean - integer inputs means result will be rational

Run this one

Perl 5 -lpF, 24 22 bytes
#!/usr/bin/perl -lpF
$_=1x@F/s/./+$&/g*eval

Try it online!
Doing it as a list of digits is only 1 byte shorter and feels like cheating:
#!/usr/bin/perl -p
$;+=$_}{$_=1x$./$.*$

Try it online!

what's usrt? :P

@ASCII-only Wait,you don't have your executables in the /usrt directory ? Anyways, fixed. Thanks

Perl 6, 15 bytes
{.sum/$_*1 x$_}

Try it online!
The average is the digit average applied to each decimal position, so digit average times 111.... 1 x $_ produces a string of 1s which get coerced to strings by the multiply.
Takes a list of digits as input. A sequence would require a .cache before the sum, and a number or string input would need a .comb.

Ruby, 60 bytes
->n{a=b=c=0.0;a,b,c,n=a+n%10,b*10+1,c+1,n/10while n>0;a*b/c}

Try it online!

Wolfram Language (Mathematica), 22 bytes
FromDigits[0#+Mean@#]&

Try it online!

Ruby, 33 bytes
->n{10**(k=n.size)/9*n.sum*1.0/k}

Try it online!
A port of Dennis's Python 3 answer
Here's my lame attempt (74 bytes)
->s{a=(1..s.size).map{|i|s.chars.rotate(i).join.to_i}|[];a.sum*1.0/a.size}

Try it online!

JavaScript (Node.js), 43 bytes
x=>eval(x.join`+`)*'1'.repeat(n=x.length)/n

Try it online!

Can we take input as a list of digits? – Dennis♦ 7 mins ago
@Dennis Sure, that's fine. Go save some bytes. :p – AdmBorkBork 3 mins ago

Japt, 8 bytes
Takes input as an array of single digit strings.
xpUÊ)÷UÊ

Try it

Explanation
             :Implicit input of array U
 pUÊ         :Repeat each string length of U times
x   )        :Reduce by addition
     ÷UÊ     :Divide by the length of U

Python 2, 83 77 bytes
def f(a):b={int(`a`[i:]+`a`[:i])for i in range(len(`a`))};print sum(b)/len(b)

EDIT: -6 bytes thanks to @ovs

35, Dennis' solution, 38, not Dennis' solution

APL (Dyalog Unicode), 21 14 bytesSBCS
+/≢÷⍨⍳∘≢(⍎⌽)¨⊂

Try it online!
Tacit prefix function. Takes input as a string.
Thanks to Adám for an enlightening 7 byte save.
How?
+/≢÷⍨⍳∘≢(⍎⌽)¨⊂ ⍝ Main fn, example argument '123'
              ⊂ ⍝ Enclose the argument (turns it into a scalar)
             ¨  ⍝ Use each of the left arguments to
         ( ⌽)   ⍝ Rotate, then
          ⍎     ⍝ Convert strings into numbers
      ⍳∘≢       ⍝ Tally (≢) the argument, then index (⍳) from 1.
                ⍝ Returns 1 2 3 for a 3 digit argument, and rotates the argument 1, 2, then 3 times.
     ⍨          ⍝ Use the result as left argument for
    ÷           ⍝ Divide
   ≢            ⍝ By the number of rotations
+/              ⍝ And sum the results

:| still can't get used to APL comments

Charcoal, 11 bytes
Ｉ∕×ΣθＩ⭆θ1Ｌθ

Try it online! Link is to verbose version of code. Explanation:
    θ  θ  θ Input as a string
   Σ        Sum of digits
      ⭆ 1   Replace each character with the literal `1`
     Ｉ      Cast to integer
  ×         Multiply
         Ｌ  Length
 ∕          Divide
Ｉ           Cast to string
            Implicitly print

J, 10 bytes
10#.#$+/%#

This is a port of H.PWiz's great APL solution to J.
Takes a list of digits as an argument.
Explanation:
+/%# the average of the digits (divide % the sum of the digits +/ by their  number #)
#$creates a list of copies of the average according to the number of digits
10#. convert form base 10
Try it online!

Pari/GP, 34 bytes
Takes input as a list of digits.
n->fromdigits([vecsum(n)|x<-n])/#n

Try it online!

C++, 218 208 bytes
-10 bytes thanks to Zacharý
#include<set>
#include<cmath>
float a(int m){std::set<int>a;int n=m,t,c=0;for(;n>0;n/=10)++c;for(;n<c;++n){a.insert(m);t=m%10;m=m/10+std::pow(10.f,c-1)*t;}int s=0;for(int v:a){s+=v;}return float(s)/a.size();}

And, to test :
int main() {
    printf("%f\n%f\n%f\n%f\n",a(123),a(4928),a(445445),a(777));
}

You don't need spaces between #include and <, and you can remove the {} around both ++c; and s+=v;. You might be able to move the int s=0 to the beginning with your other variables.

Also, I don't think you need the n=0 in the second for loop, as it should have reached 0 by then. m/=10;m+=std::pow(10.f,c-1)*t; => m=m/10+std::pow(10.f,c-1)*t. And wouldn't using int instead of auto work?

You can still move int s=0; with your other variables, and do you need the braces around the s+=v;?

168 bytes

n>0 => n might work.

05AB1E, 3 bytes
œÅA

Port of @tybocopperkettle's Vyxal answer, so make sure to upvote him/her as well!
Try it online or verify all test cases.
Explanation:
œ    # Get all permutations of the (implicit) input
     #  e.g. 123 → ["123","132","213","231","312","321"]
 ÅA  # Take the average of this list
     #  → 222.0
     # (which is output implicitly as result)

Thunno E, \$ 9 \log_{256}(96) \approx \$ 7.41 bytes
DLzP.ZDAA

Attempt This Online!
Port of Vyxal.
Explanation
DLzP.ZDAA  # Implicit input. The E flag keeps it as a string.
DL         # Duplicate and get the length of the input string.
  zP       # Permutations of the input with the same length.
    .ZD    # Converted to integers from lists of characters.
       AA  # Get the average of this list of integers.
           # Implicit output.

TI-Basic, 10 bytes
mean(Ans)int(1/9₁₀^(dim(Ans

Takes input in Ans as a list. Port of Dennis's Python 3 answer.

Pyth, 12 bytes
csms.<zdlzlz

Probably improvable.
c         lz     Divide by the length of the input:
 s               Reduce by +
  m     lz       Map over d = [0 ... the length of the input]:
   s.<zd         Shift the input d characters to the left and cast to int

Try it here!

There's a built-in average function o.  If you do that and do I/O as lists of digits, you can get it down to 8 bytes.

Ah, I was taking "If applicable, you can assume that the input/output will fit in your language's native Integer type." to mean that it had to be an integer if taken in as Q.

J, 23 Bytes
(+/%#)".~.(|."0 1~i.@#)

Takes input as a string
Explanation
          (|."0 1~i.@#)  | All rotations
        ~.               | Deduplicate
      ".                 | Convert each to int
(+/%#)                   | Average

Matlab, 65 bytes
c=num2str(n);l=nnz(c);mean(str2num(c(mod((1:l)+(0:l-1)'-1,l)+1)))

Gonna work on this, pretty sure it can be done better.

Clojure, 139 bytes
#(let[n(count %)G(set(apply map list(for[i(range n)](take n(drop i(cycle %))))))](/(apply +(for[g G](read-string(apply str g))))(count G)))

Quite sub-optimal language features for converting sequences of characters to integers.

dc, 37 bytes
This is a full program, reading input and printing the output:
?1sd[O~rzsadO<x+ldO*1+sd]dsxxOkld*la/p

It works by separating the number into its digits, and multiplying the mean of the digits by the appropriate length repdigit (which is built up in d as we go).
?                               # read input
 1sd                            # initialize d=1
    [                   ]dsxx   # define and execute recursive macro x:
     O~r                        #   remainder and quotient of /10
        zsa                     #   a = number of digits
           dO<x                 #   recurse if needed
               +ldO*1+sd        #   increment repdigit d
                             Ok         # after executing x, set precision
                               ld*la/   # multiply by repdigit; divide by a
                                     p  # print the result

PowerShell Core, 45 bytes
($args-join'+'|iex)*("1"*($l=$args.Count))/$l

Try it online!

Pyt, 7 bytes
ĐŁᴇ₉⇹µ*

Try it online!
Takes the number as a list of digits
    Đ          implicit input (n); Đuplicate on stack
     Ł         get Łength (l)
      ᴇ₉       get repunit of length l
        ⇹µ     get mean of digits of n
          *    multiply; implicit print

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
ASCII Mountain Range
This is a CC-BY-SA challenge from the CCSC Mid-South Programming Contest 2018.
Author(s): Brent Yorgey
Source: Consortium for Computing Sciences in Colleges Mid-South Programming contest 2018
https://ccsc18.kattis.com/problems/ccsc18.mountainrange

Good news: you have been hired to do all the special effects for a film! One of the scenes will take place outside, on a windswept plain with a towering mountain range in the background. Your job is to turn a description of the mountain range into a rendered image.
The bad news: the film’s producers have an extremely small budget, and so they can’t afford luxuries like rendered 3D graphics made up of pixels. Hence, you will be making your image out of ASCII characters.

Write a function or full program to produce mountain range ASCII art according to the spec below. This is code-golf; tie breaker is earlier submission.
Input
You will receive a list of 5-tuples in any standard input format for PPCG and/or your language. Each 5-tuple is the values (x, h, z, t, s) representing one mountain of the range you will draw.

x is the x-coordinate of the mountain's peak, with 1≤x≤199.
h is the height of the mountain, with 1≤h≤100.
z indicates the relative distance of the mountain from the viewer, with 1≤z≤m. The smaller the value of z, the closer the mountain is to the viewer. Closer mountains hide ones that are farther away.
t is the height of the treeline. The side of the mountain up to the treeline should be filled with trees, represented by the ASCII character Y.
s is the height of the snowline. The side of the mountain above the snowline should be filled with snow, represented by the ASCII character *.

The base of each mountain will not extend beyond 0 or 200 horizontally; you may assume that 0≤x−h and x+h≤200. The height of each mountain is no more than 100, so all mountains will fit within a 100x200 grid. The snow and trees will not overlap or exceed the height of the mountain; you may assume that 0≤t≤s≤h. All numbers are non-negative, and all z-values will be unique.
Output
The output should consist of an ASCII drawing of the specified mountain range. Each mountain is triangular in shape with its sides drawn using / and \ characters. For example, here is a mountain of height 4:
   /\
  /  \
 /    \
/      \

This mountain has x-coordinate 4, since the horizontal distance from the left margin to its peak is 4 units.
Trees and snow should fill the interior of the mountain but not obscure the sides of the mountain. For example, here is a mountain with height 6, treeline height 2, and snowline height 3:
     /\
    /**\
   /****\
  /      \
 /YYYYYYYY\
/YYYYYYYYYY\

That is, the trees extend from the base of the mountain up to a height of 2
units, and the snow starts at a height of 3 units and extends to the top of the mountain.
Mountains with a smaller z-coordinate may hide all or part of a mountain with a larger z-coordinate; see the third sample input/output below.
Leading whitespace is significant, and should be as specified by the x-position and width of the drawn mountains. Leading/trailing newlines are allowed, and any amount of spaces after each line.
Examples
(8, 5, 1, 2, 3)
       /\
      /**\
     /    \
    /YYYYYY\
   /YYYYYYYY\

(2, 2, 1, 0, 1)
 /\
/  \

(8, 5, 2, 2, 3),
(2, 2, 1, 0, 1),
(9, 8, 3, 1, 4),
(17, 4, 4, 4, 4)
        /\
       /**\
      /****\
     /*/\***\
    / /**\   \  /\
   / /    \   \/YY\
 /\ /YYYYYY\   \YYY\
/  \YYYYYYYY\YYY\YYY\

If you find other interesting examples, please share in your answers!

Sandbox (deleted). Related.

Python 2, 194 191 186 bytes
g=map(list,[' '*200]*100)
for x,h,z,t,s in sorted(input(),key=lambda m:-m[2]):
 for i in range(h):g[-h+i][x+~i:x-~i]=['/']+[' *Y'[(i<h-s)-(i>=h-t)]]*2*i+['\\']
for l in g:print''.join(l)

Try it online!
Prints the whole 100x200 grid.

Charcoal, 79 bytes
  ＡθＷθ«≔⊟Φθ⁼§κ²⌈Ｅθ§μ²ι≔Φθ¬⁼κιθ≔§ι¹ηＪ§ι⁰±η≔⟦§ι⁴⁻η§ι³η⟧ζＦY *«≔⊟ζεＧ↘ε←⊗ε↗εκ→»Ｐ↘η←↙η

Try it online! Link is to verbose version of code. Note: Leading space used to force the required indentation. Explanation:
ＡθＷθ«

Loop while the input array is not empty.
≔⊟Φθ⁼§κ²⌈Ｅθ§μ²ι

Find the most distant mountain in the array.
≔Φθ¬⁼κιθ

Remove it from the array.
≔§ι¹η

Get the height of the mountain.
Ｊ§ι⁰±η

Jump to the top of the mountain.
≔⟦§ι⁴⁻η§ι³η⟧ζ

Get the snowline, treeline and height.
ＦY *«

Loop over the trees, bare mountain and snow.
≔⊟ζεＧ↘ε←⊗ε↗εκ→»

Draw a trapezium of the desired height.
Ｐ↘η←↙η

Draw the sides of the mountain.

Ruby, 133 bytes
->a{r=[];a.sort_by{|x|-x[2]}.map{|x,h,z,t,s|h.times{|i|(r[i]||=?\s*200)[x-j=h-i,j*2]=?/+" Y*"[i<t ?1:i<s ?0:2]*~-j*2+?\\}};r.reverse}

Try it online!
Anonymous lambda. Takes input as array of parameter arrays for mountains, returns array of strings.
Walkthrough
->a{                 #Input array is a
 r=[];               #Initialize the output array
 a.sort_by{|x|-x[2]} #Sort by decreasing distance
 .map{|x,h,z,t,s|    #Loop through the mountains
  h.times{|i|        #For each mountain fill h lines starting from the ground
   (r[i]||=?\s*200)  #If we haven't yet been so high, initialize with spaces
   [x-j=h-i,j*2]=    #Take a slice from x-(h-i) for double length of h-i
    ?/+" Y*"[i<t ?1:i<s ?0:2]*~-j*2+?\\ #Draw the sides of the mountain (/\),
  } #with (h-i-1)*2 of the appropriately selected filler symbols in the middle
 };r.reverse         #Reverse to the top->bottom order suitable for printing
}

C (clang), 284 261 257 252 bytes
a,b,*z,i,j,k,o;c(*a,*b){return b[2]-a[2];}f(*m,n){qsort(m,n,5*sizeof *m,c);for(i=101;--i>0;puts(""))for(j=0;++j<200;putchar(o))for(o=32,k=0;k<n;z=&m[5*k++],a=z[0]-z[1]+i,b=z[0]-~z[1]-i,o=z[1]/i&&j/a&&b/j?"/\\*Y "[j==a?0:j==b?1:i>z[4]?2:z[3]/i?3:4]:o);}

Try it online!
Credits:
-3 bytes Thanks Kevin Cruijssen
f() takes these params:
m: array of integers with all mountains' parameters
n: number of mountains
m should be a flat array of specifying x, h, z, t and s for mountains with each mountain's parameters appended to this array.
f() prints full 100x200 grid of ASCII scenery render.
Ungolfed:
a,b,*z,i,j,k,o;
c(*a,*b){return b[2]-a[2];}             //comaprison function for sort by z-order
f(*m,n){
 qsort(m,n,5*sizeof(*m),c);             //sort mountains by z-order
 for(i=100;i>0;i--,puts("")) {          //for each row
  for(j=1;j<200;j++){                   // for each pixel in this row
   o=' ';                               //initialize pixel to background pixel value
   for(k=0;k<n;k++) {                   // for each mountain, in z-order distant to close
    z=&m[5*k];                          //start pointer for mountain's params
    a=z[0]-z[1]+i;                      //min x limit of mountain on this line
    b=1+z[0]+z[1]-i;                    //max x limit of mountain on this line
    o=z[1]/i && j/a && b/j ? "/\\*Y "[j==a?0:j==b?1:i>z[4]?2:z[3]/i?3:4]:o;
                                        //calculate pixel value ovrwriting previous mountain if necessary
   }
   putchar(o);                  //print pixel value
  }
 }
}

for(j=1;j<200;putchar(o),j++) can be for(j=0;++j<200;putchar(o)) (-2 bytes) and b=1+z[0]+z[1]-i can be b=z[0]-~z[1]-i (-1 byte)

Thanks @Kevin. Applied same trick to i too, saved 2 more bytes.

Suggest 40 instead of 5*sizeof *m, --i instead of --i>0, b=*z++-~*z-i,o=*z/i&&j/a&&b/j?j-a?j-b?i>z[3]?42:z[2]/i?89:32:92:47:o)a=i-1[z=m+5*k++]+*z instead of z=&m[5*k++],a=z[0]-z[1]+i,b=z[0]-~z[1]-i,o=z[1]/i&&j/a&&b/j?"/\\*Y "[j==a?0:j==b?1:i>z[4]?2:z[3]/i?3:4]:o)

JavaScript (Node.js), 265 243 229 210 204 203 bytes
a=>a.sort((x,y)=>y[2]-x[2]).map(([x,h,,t,s])=>{for(y=h;y--;)for(i=h+x-y;i--;)(d=R[y]=R[y]||[])[i]=i<x-h+y?d[i]||" ":"Y *\\/"[i>x-h+y?i<h+~y+x?y<t?0:y<s?1:2:3:4]},R=[])&&R.map(x=>s=x.join``+`
`+s,s="")&&s

Try it online!