# [Haskell], 96 bytes

<!-- language-all: lang-hs -->

    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!][TIO-jg2i5fvw]

[Haskell]: https://www.haskell.org/
[TIO-jg2i5fvw]: https://tio.run/##bY3LDoIwEEX3fgWZuIBEI8@NOF/CZdEFCrFODNKd/16HVuLGpJlzO73pGc3rPljrvZAQF02rU1krE@JS0eq1UgLEgaT7tZfH94J4bZcRVURNvFaagEQqzr1hEqwnWBSIHlCC8BOoRXRBZfj6QiZEJyjfugWCCVRuodpCjaAFNfj5afcwk/BznmTZd6k72EFuy5heJ7sMc8rsMpNlb3c5moOk7tz12Yn/dXr/AQ "Haskell – Try It Online"

# [Haskell], 109 bytes

<!-- language-all: lang-hs -->

    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!][TIO-jg2hyk02]

[Haskell]: https://www.haskell.org/
[TIO-jg2hyk02]: https://tio.run/##nY3LCsIwEEX3fkUowqRQsU3aVZ0vsS6yiDYYB6nJzn@PeVTcCIKre@bODGdWj6u2NgRiQIDdMEbACH0C9oYxgkwwTYAFAFDk6zZCyg4wzwIw/8g1@7UfSpLENiisfgtFEX6UySnFn85qc1OG8L4Yctsj943VdHEzPxvr9MIRfa3q@ukPO9UQ83v8tj@FFw "Haskell – Try It Online"
# [Haskell], 122 bytes

<!-- language-all: lang-hs -->

    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!][TIO-jg2hnai0]

[Haskell]: https://www.haskell.org/
[TIO-jg2hnai0]: https://tio.run/##bY7BDsIgDIbvPgVZTLolMw623eyTiAcO0y1iY@a4@e4IBTwYe/k/Wpp@s3ndJ2u9JwEEqOQuAALKIYIooMNMKiYNmFoA2HOrC3sxJeAYU@Xsw4eYQ36PKYlrgFTYeYNVua6pnGcSX9LJIDNLZGYN5ujBEEUYVIGowjCUzpjh16baPcxC@FwX2vbn2rV2ots219fFbtNaI7rGNM3bnQ6mJeGO@G9@8R8 "Haskell – 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.