[Question]
  [
Write a function or program that accepts one character (or a string of length 1) as input, and outputs the number of times that character occurs inside the code.
* This program must be a [Proper Quine](https://codegolf.meta.stackexchange.com/questions/4877/what-counts-as-a-proper-quine), only in the sense that it cannot, for example, read itself as a file, etc.
Input can be any character, printable or not. Output may be to standard out, or as a return value from a function. This is code golf, so the shortest submission in bytes wins. Good luck!
  
[Answer]
# [Python 2](https://docs.python.org/2/), ~~30~~ 22 bytes
*-8 bytes thanks to @Mukundan314*
```
`'``*2.count'*2`.count
```
[Try it online!](https://tio.run/##dc0xDoMwDEDRvafwFjsDUjN14SZIDaKkmMGOXKOK06cDLAzd3vL16@6LSmqlH1oOOcfUTbqJh5jyoVaNxSGEblUWnBZDJohQThIUNWBgARvlPeM9PYhu1@qj5vMLbfw@WermSER/fj8 "Python 2 – Try It Online")
[Answer]
# [COW](https://bigzaphod.github.io/COW/), ~~711~~ ~~519~~ ~~504~~ ~~390~~ 387 bytes
```
moOMooMOOmOoMoOMoOMoOMoOMoOMoOMoOMOOmoOMOoMOoMOoMOoMOoMOoMOoMOoMOoMOoMOomOoMOomoomoOMMMMOOMOomoomoOMoOMoOMoOMoOMoOMoOMoOMoOmOomooMMMMOOMOoMOoMMMmoOMoOMoOmoOMOomOomOoOOOmooMMMMOOmOoMoOMoOMoOMoOMOOmoOMOoMOoMOoMOoMOoMOoMOoMOomOoMOomoomoOMMMmoOMOomoOMoOmOomOoOOOmooMMMMOOMoOMoOMMMmoOOOOMoOMoOMoOmoOMOoMOomOomOoOOOmooMMMMOOmoOmoomoOMOOmoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOMoOmOoMOomoomoOOOM
```
[Try it online!](https://tio.run/##jY5RDoMwDEP/e4ocYYVJiENEPsS@I39y/NK0pQM2EJUVpYplvw@XlIxQUgED1fcf5ZNP3svqJN2cH/D9XsiKoZtdqt1fS60IztCcZ85bvBNVy@ztx@QWWGzAjnPL/wPj1xJYMZ5pT5V7kkp8vQMkDnMwkXEKlBinpGEF "COW – Try It Online")
*I appreciated a lot the previous solution (504 bytes) because it's deducted step by step, if you are interested please take a look at that in the timeline...  
Now I furnish the program with a more "sensible" structure that promises to be less expensive (in terms of total byte count) but finding just a working set of values isn't simple...  
To find the best, **brute force** comes in.*
**The next sections refers to the 390 bytes answer since it's simpler to explain that and then tell what it's done to save 3 bytes.**
## What it does
\$L = \{M,O,o,m\}\$ is the set of used chars and \$n\_1,\dots ,n\_4\$ their count.  
The program has a structure that allows to form the output number \$n\_i\$ as
$$
\begin{align}
n\_i = x\_i\times cf+y\_i
\end{align}
$$
Furthermore we don't need to form \$x\_i\$ and \$y\_i\$ every time from zero, we reach them using the *partial sums* of 2 sequences occurring in cells `[2]` and `[3]` respectively.
```
[0]: multiplier for [1]     [1]: input-current_char     [2]: x_i     [3]: y_i
[1] = getchar()
if[1] { [1]-=77(M), [2]+=8, [3]+=0, cut[1] } paste[1]  //checks for 'M' and prepares its count
if[1] { [1]-= 2(O), [2]+=2, [3]+=0, cut[1] } paste[1]  //checks for 'O' and prepares its count
if[1] { [1]-=32(o), [2]-=1, [3]-=1, cut[1] } paste[1]  //checks for 'o' and prepares its count
if[1] { [1]+= 2(m), [2]-=6, [3]-=2, cut[1] } paste[1]  //checks for 'm' and prepares its count
if ![1]                                                //input was one of the letters above
    print [2]*13+[3]
else                                                   //input was something else
    print [4] (0)
```
As long as the input doesn't match any letter in \$L\$, `[1]` stays ≠ 0 and `[2]` and `[3]` hold \$x\_i\$ and \$y\_i\$ of the last tested letter.  
Otherwise, if `[1]` has become 0, those value are no longer updated and at the end they will form the related \$n\_i\$.
(When the input isn't a letter in \$L\$, after the 4 tests `[1]` is still ≠ 0 so the flow enters a loop (`[>]`) that sabotages the placement of the head, thus prevents from printing \$n\_4\$ (the number of `o`).)
## How
I've first constructed the exoskeleton: the complete program without the info about its char count.  
That is without \$cf\$(*common factor*) and the 2 sequences that form \$x\_i\$ and \$y\_i\$.
* **The exoskeleton**
```
    moo ]    mOo <    MOo -    OOO *    Moo .
    MOO [    moO >    MoO +    MMM =    oom o
    >.
    [  <+++++++[>-----------<-]>  > ? > ? <<  =*]=
    [             --              > ? > ? <<  =*]=
    [     <++++[>--------<-]>     > ? > ? <<  =*]=
    [             ++              > ? > ? <<  =*]=
    [>]
    >[> ? <-]>o
```
Some of them can be negative but I know that in order to write them I'll spend \$len\$: the sum of their absolute value in `MoO`s and `MOo`s (`+` and `-`).
*Thanks to this condition the comptutation is rather straightforward.*
## Brute force
* \$cf>0\qquad\qquad A=\{a\_1,\ a\_2,\ a\_3,\ a\_4,\ a\_5,\ a\_6,\ a\_7,\ a\_8\}\$
* \$x\_i=\sum\_{j=1}^{i} a\_j \qquad y\_i=\sum\_{j=5}^{4+i} a\_j\$
* \$n\_i = x\_i\times cf+y\_i\$
* \$len = cf + \sum\_{j=1}^{8} |a\_j|\$
$$
(\*)\begin{cases}
n\_1=|M|+len\\
n\_2=|O|+len\\
n\_3=|o|+len\\
n\_4=|m|
\end{cases}
$$
Given the letter count in the exoskeleton \$|M|=71,\ |O|=97,\ |o|=85,\ |m|=38\$  
we can now search for \$cf\$ and \$A\$ that satisfies \$(\*)\$ minimizing \$len\$.
`cf = 13, A = [8, 2, -1, -6, 0, 0, 1, -2]` is the best for that exoskeleton (\$len=33\$)
## Finished program
```
>.
[  <+++++++[>-----------<-]>  >  ++++++++  >      <<  =*]=
[             --              >     ++     >      <<  =*]=
[     <++++[>--------<-]>     >     -      >   +  <<  =*]=
[             ++              >   ------   >  --  <<  =*]=
[>]
>[>+++++++++++++<-]>o
```
As you can se when some \$a\_i\$ is \$0\$ its relative pair of `>` `<` became non-functional. But obviously we can't take them off in retrospect.
## -3 bytes, 387 bytes
Juggling with the exoskeleton I've found that there is one configuration slightly different that overall saves 3 bytes (1 instruction). What's different?
* One `*` is replaced with `[-]` that has the same effect *(+2 instr.)*
* Using one `*` \$x\_4\$ is detached from the partial sum: \$x\_4=a\_4\$ *(+1 instr.)*
* A pair of `>` `<` are saved because \$a\_5=0\$ *(-2 instr.)*
The letter count of this exoskeleton is \$|M|=73,\ |O|=98,\ |o|=86,\ |m|=37\$  
`cf = 13, A = [8, 2, -1, 3, 0, -1, 1, -2]` is the best. (\$len=31\$) *(-2 instr.)*
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 54 bytes
```
y=>"3.>=includes(*)\\\"y3.>=includes(*)".includes(y)*3
```
[Try it online!](https://tio.run/##nU67DoIwFN39ihumFqQJMDhoWfgEVwYu0EJNbUlbNXx97WAcHF1OzuPmnnPDJ/rJqS2Uxs4iSh533mYNa7kyk37MwpOc9n2f7T9exr5ip3kTpXVAEDg09RkQLlDVp0SKgh5gssZbLZi2CxnTyTU4ZRYmnb13K7ouNROkR5BkTPhJHb6G/7YMzG9ahfSMaWGWsEIJFY1v "JavaScript (Node.js) – Try It Online")
A bit convoluted but I tried to avoid using `f=` that would violate the proper quine requirement. The code is written in the way that all characters occur exactly 3 times.
[Answer]
# JavaScript (ES6), ~~40~~ 38 bytes
A function made of 19 distinct characters used twice each.
```
_=>_.match`[\\]chmt[-a.02:=>?^^-]`?2:0
```
[Try it online!](https://tio.run/##TU5LasMwEN37FLOThLBI3ELBqeJF6AmyzFfI32KPjCyyKb1BoZsu23v0PLlAj@COXQJlYHjM@82zuZjB@qYPMbq8GEs9nvT6pDoTbH3e7fcHW3dhFxu1SFK9zo7H@HDOknQxWpKDhlIFtw2@wYqLVRSVznOk812yAoRHWCYPBKQU8BIBWGL@xKr0rtvUxm8ohiNZicVA/JSrhr5tArdCtQVWoYYYlpPCF8NUScSsdzi4tlCtqzj@e0P1Jn/CnN8LkFQpgdHI2XzDfE7Sc2UG7Of7/fr5QZtBCuz69cYENbyOvw "JavaScript (Node.js) – Try It Online")
### How?
The range going from `[` to `a` allows us to match the backtick and the underscore, which are both already doubled in the code, without explicitly including them in the pattern.
This method comes with two minor drawbacks:
* Because this range also includes `^`, we need to insert it twice in the code as well although it's not part of the payload.
* We also have to insert a second `-`.
Character set:
```
-.02:=>?[\]^_`achmt
```
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 10 bytes
```
y/+N"y/+N"
```
[Try it online!](https://tio.run/##K6gsyfj/v1Jf208JTPz/r@6nDgA "Pyth – Try It Online") 
[Test cases](https://tio.run/##K6gsyfiv/L9SX9tPCUy4/v@vXqnOpa4PxNpA7AfESkBcoQ4A "Pyth – Try It Online")
```
y/+N"y/+N"
    "y/+N"    String literal
  +N          Append the string `"`
 /            Count occurrences of the input in that string
y             Multiply by 2
```
[Answer]
# [J](http://jsoftware.com/), 34 bytes
```
(2*1#.=&'(2*1#.=&)+6*=&')+6*=&''''
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NYy0DJX1bNXUYQxNbTMtIBdKAcF/TS6u1OSMfAUzBVuFNAWQEIRvBOFroHKNoFwTCFcLVdYQlauMytVD1WuLylVDVayJytVG5Zqpc3H5Oekp5GYWF2fmpSskZyQWQRQYQBRUABX8BwA "J – Try It Online")
## how
```
                             single quote 
         quoted program      adjustment
                |              /     
        vvvvvvvvvvvvvvvv _____/___ 
(2*1#.=&'(2*1#.=&)+6*=&')+6*=&''''
^^^^^^^^                ^^^^^^^^^^
        \               /
         regular program
```
* Everything above a `^` is part of the "regular program".
* The rest is "the program quoted", but with one exception:
	+ The quoted program doesn't include the program's single quote characters `'`
* `2*1#.=&'...'` - Two times `2*` the sum of `1#.` the total number of times the input char matches a char in "the quoted program". One for the actual program char, one for its quoted twin.
* `+6*=&''''` - Plus six times `+6*` the `1/0`-indicator of whether the input char is equal to a single quote `=&''''`. This is the hardcoded knowledge that there are 6 single quotes in the program.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 12 bytes
```
".+#H".""+#H
```
[Run and debug it](https://staxlang.xyz/#c=%22.%2B%23H%22.%22%22%2B%23H&i=33%0A34%0A35%0A36%0A42%0A43%0A44%0A45%0A46%0A47%0A71%0A72%0A73&a=1&m=2)
Takes as input a code point. Those provided in the test are for each character in the program, as well as their immediate predecessors and successors.
### Explanation:
```
".+#H".""+#H
".+#H"          String literal ".+#H"
      .""       String literal "\"\""
         +      Concatenate
          #     Count occurrences of the input
           H    Double
```
Constructs a string of half the program, permuted somehow. Counts occurrences there, then doubles.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~12 10~~ 8 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-2 thanks to [caird coinheringaahing](https://codegolf.stackexchange.com/users/66833/caird-coinheringaahing) (input is a character, not a string!)
```
“ḤṾċⱮ”Ḥċ
```
A monadic Link accepting a character that yields the count.
**[Try it online!](https://tio.run/##y0rNyan8//9Rw5yHO5Y83LnvSPejhrkw5v@HOxYdbtdx0HRHV6H3aOM6AA "Jelly – Try It Online")**
### How?
```
“ḤṾċ”ḤṾċ - Main Link: character, c
           (A full program with a single character as input gives the main
            Link a list of characters - i.e. S = ['c'])
“ḤṾċ”    - list of characters = ['Ḥ', 'Ṿ', 'ċ']
     Ḥ   - double = ["ḤḤ", "ṾṾ", "ċċ"]  (Python strings)
      Ṿ  - un-eval = ['“', 'Ḥ', 'Ḥ', 'Ṿ', 'Ṿ', 'ċ', 'ċ', '”']
       ċ - count occurrences of c (in the un-eval-ed list)
         - implicit print (a list with a single entry just prints that entry)
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 20 bytes
```
Ｉ⊗№⁺´”´””yＩ⊗№⁺´´yＳ”Ｓ
```
[Try it online!](https://tio.run/##S85ILErOT8z5///9npWPuqY/apn2qHHXoS2PGuaCCSCqRJU5tAUosBkoDiT//z@0BQA "Charcoal – Try It Online") Explanation:
```
    ´”´”                Literal string `””`
   ⁺                    Concatenated with
        ”yＩ⊗№⁺´´yＳ”     Literal string `Ｉ⊗№⁺´´yＳ`
  №                Ｓ    Count matches of input character
 ⊗                      Doubled
Ｉ                       Cast to string
                        Implicitly print
```
Charcoal has two ways of quoting non-ASCII characters, `´` (which quotes a single character) and `”y...”` (which quotes anything except `”`). Trying to do everything with `´` is awkward because it uses too many of them; the best I could do was 26 bytes.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 14 bytes
Port of the Stax answer. `¢` is order-sensitive, which is fairly annoying here.
```
"„Js¢·"„""Js¢·
```
[Try it online!](https://tio.run/##yy9OTMpM/f9f6VHDPK/iQ4sObQexlJQg7P//D20HAA "05AB1E – Try It Online")
# [05AB1E](https://github.com/Adriandmen/05AB1E), 18 bytes
As for this... I wrote this myself.
```
„…J…¢s·'„'D''DJs¢·
```
[Try it online!](https://tio.run/##yy9OTMpM/f//UcO8Rw3LvID40KLiQ9vVgXx1F3V1F6/iQ4sObf//3xAA "05AB1E – Try It Online")
## Explanation
```
„…J                 2-char string. …, J
   …¢s·             3-char string. ¢, s, ·
       '„           1-char string. „
         'D         1-char string. D
           ''       1-char string. '
             D      Copy this character.
              J     Join the stack.
               s¢   Count occurances of the input in the string.
                 ·  Multiply the count by 2. (Perfectly makes the 0-count still 0.)
```
[Answer]
# perl, 128 bytes, assuming ASCII input only
```
print 1;#!"$%&'()*+,-./023456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghjklmoqsuvwxyz{|}~...
```
Replace the trailing `...` with the 33 unprintable characters (ASCII 0 .. ASCII 31 + ASCII 127), with the newline at the end. (If anyone knows how to put unprintable characters in a textfield and have them show up here, I'm all ears).
[Answer]
# [R](https://www.r-project.org/), ~~96~~ ~~82~~ ~~126~~ ~~94~~ 90 bytes
```
3*sum(unlist(strsplit(c('"',"#'''((()))*,,3=acilmnprsssttu"),''))==scan(,''))##()*,3amprst
```
[Try it online!](https://tio.run/##HcohDsAgDAVQv2MU0d@lDs1hCIoECKHl/IzMPfHWOfG13bFHq@YwXzZbdRQwsVJgZgAi8qrGlEttfcxlZu6bRJlFUrKSB36HgDtj7vf4IabnfA "R – Try It Online")
*Edit1: thanks to math junkie for pointing-out a horrible bug in the original version (the `\` character): hence the temporary increase and subsequent decrease in byte-length, as successive patches were added in panic..*
*Edit2: -4 bytes: Copying the entire program into the 'look-up' string seemed wasteful ([94 bytes](https://tio.run/##K/r/30iruDRXozQvJ7O4RKO4pKi4ICezRCNZQ11JSV1HCaesuo6mjrq6pqatbXFyYp4GmK2EKfRfSV2J6z8A)), so instead added extra characters so that every character was present an even-number of times, and now just include half the program (character-wise) in the look-up string*
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 18 bytes
```
∈"∈∈\\\"∧33||"∧3|∧
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/pfXa6koGunoFRu/6htw6Ompoe7Omsfbp3w/1FHhxIQA1FMTAyQtdzYuKYGTNcAif//QZIxSjExYBEdBb1HHSsKy1OLSipLM/MLomMTi1PSDI2MTUzNzC0sDZQA "Brachylog – Try It Online")
Brachylog doesn't really have any good way to get quotes without escaping them in a string literal (or using the `Ṭ` constant, which came out longer when I tried it), so the approach I came to is to simply triple down on everything else.
(I don't know why the testing header runs out of stack after it's done every test case; I'd think it's something to do with the unbound variable output for 0 but [it works fine on individual inputs](https://tio.run/##SypKTM6ozMlPN/r/qG3Do6bG8v@POjqUgBiIYmJigKzlxsY1NWC6Bkj8/6@kqAQA)... so long as [an unbound variable](https://tio.run/##SypKTM6ozMlPN/r//1FHhxIQA1FMTAyQtdzYuKYGTNcAif//lRSV/kcBAA) is indeed an acceptable way to give 0. If it's not, [+3 bytes](https://tio.run/##SypKTM6ozMlPN/r//1FHhxIQA1FMTAyQtdzYuKbGwADMqgESBv//Kykq/Y8CAA))
[Answer]
# Python 3, 48 bytes
```
x="(x+2*chr(34)+'x=;f=eval(x)').count";f=eval(x)
```
[Try it online!](https://tio.run/##jY1BDoIwFET3nOKnG/4XQqR1QWp6EzakgpBoS2o1FeLZK4QYXbqamZe8zPj0vTUixqAYhozvdO9QHChLgzp2qn00FwyUUqHt3Xj2RXFSLKj6D6n@sVjSWQcaBgOuMecWBc9LXpFMYHSD8cjmvRSnF8ylFLcluOTrEmuwYpGvjUedw/qoKYdp@8BtL6D7VKL4Bg "Python 3 – Try It Online")
Idea: Store code in string. The stored code returns function that counts characters in the string within which it is contained. Evaluate the string to get the function. Special care for characters wrapping the string.
# Python 3 without `eval` I, 48 bytes
```
 lambda c:3*(c in" \\\"(())**33::abbcddiillmmnn")
```
[Try it online!](https://tio.run/##fcuxDoIwEAbgnae43NQjhEhvMU14ky6lFWlCC0EchPjstWhcHJz@@//cNz/WYYqc@lan0YTOGbCKS2HBRwStNQpBVJbMSpmus855P44hxIiUthZ/jX4j/Q9qJCz6aYHjHxYTrxfBsmrkmVQB8@LjKnA/KXZP2BvFtxxSyaPxEVhnHMwqbAV2WISlCrbaTvfsPj0P/fckSi8 "Python 3 – Try It Online")
# Python 3 without `eval` II, 124 bytes
And a more creative, but much longer solution:
```
lambda c:[0o3623>(ord(c)-76)**2>195,' !!""##$$%%&&++,-..//4457889:;;==ZZ\\^^__``beeffgghhiijjkklmnnppqqrssttuuvvwwxx'][0]<<1
```
[Try it online!](https://tio.run/##nY7ZcoIwAEXf/YoYt0QRIXHBKH6I4oKBACoBQ1Cr02@nOJ0@t9Onu8zcuSf/0HEmaSVcr7r46THwAWcbK6NTQlcoUwHieDib4n6frOz5xOiBZhPCVqvd7nS63cHAGJrmaDQeT2aOM2eLheuu15632@33h8MxDIWIojhOktPpfL6kUub59aqKQuuyvN3u98ejt91Y2@XSrp4u/Ou/B71fCf7DABsiU4CDRALlyyhElBg2cTBrgFwlUiP4shgNPsHLZrSohTDyTvQt0KzHqa8RNwCPVY1tgKfJs7Lefee6ED8W4@oL "Python 3 – Try It Online")
Idea: Ensure all characters that satisfy a certain equation (`195 < (c-76)² < 1939`) appear exactly twice in the code, and return 2 for those characters (0 for all others). Maybe someone can think of a better compression for the long string, but remember expressing it may only use the same character twice.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 10 bytes
```
D#hs"D#hs"
```
[Try it online!](https://tio.run/##yygtzv6f@6ip8b@LckaxEpj4//8/mBGjZGhkbGJqZm5haVBYnlpUUlmamV@QWJySpgQA "Husk – Try It Online")
```
D             Twice
 #            the number of occurrences of the input in
    "D#hs"    "D#hs",
   s          quoted,
  h           without the second quote.
```
For the same number of bytes:
# [Husk](https://github.com/barbuz/Husk), 10 bytes
```
#S+s"#S+s"
```
[Try it online!](https://tio.run/##yygtzv6f@6ip8b9ysHaxEpj4//8/mBGjZGhkbGJqZm5haVBYnlpUUqkEAA "Husk – Try It Online")
Somewhat boring adaptation of the standard `S+s"S+s+` quine.
[Answer]
# [J](http://jsoftware.com/), 24 bytes
```
2*1#.0 :0=[
2*1#.0 :0=[
```
[Try it online!](https://tio.run/##y/r/P81WT8FIy1BZz0DBysA2mguZrfmfKzU5I18hTUFdUx3ONEAwjeBMHzcurv8A)
The second newline counts too, so it's not 23.
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 26 bytes
```
T`Tan[-a\]\n^0__-`2
[^2]
0
```
[Try it online!](https://tio.run/##DcY7CoAwEEDB/t1DESEQ4yG8QLr8NmoEmxTi/Venmqe9d686TJuoF197MDWm2LMtxYgjZJewqpVOwiMEDPF/xlJw7BycNC4WVkbmDw "Retina 0.8.2 – Try It Online")
I got the idea to use `[-a` from [@Arnauld's JavaScript answer](https://codegolf.stackexchange.com/a/205215/65425).
**Explanation**
```
T`Tan[-a\]\n^0__-`2
```
Transliterate each of the following characters into a `2`:
* The letters `T`, `a`, and `n`
* The range `[-a` which also includes `\`, `]`, `^`, `_`, and ```
* Literal `]` and literal newline
* The characters `^`, `0`, `_`, and `-`
```
[^2]
0
```
Replace any character that is not a `2` with a `0`
[Answer]
# [Perl 5](https://www.perl.org/) + `-plF`, 49 bytes
```
$_=q($_=grep/\Q@F/,qq(\$_=q($_);eval)=~/./g);eval
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3rZQA0ikF6UW6McEOrjp6xQWasRAhTWtU8sSczRt6/T19NMhHKAWrnguW65CLg2uVK4yrkSuHC5XrjAuRy4frjgu3X/5BSWZ@XnF/3ULctz@6/qa6hka6BkAAA "Perl 5 – Try It Online")
## Explanation
Pretty much the standard quine with some minor changes.
The program itself is stored in `$_` which is `eval`ed (`eval` - along with most other functions - works on `$_` by default if no argument is specified. When the program is `eval`uated, `$_` is set to the number of matches (`~~grep`) against the input char `/\Q@F/`, which is interpolated at runtime and necessitates `\Q` to escape any special chars, against the list of chars resulting from the template string `$_=q(...);eval` with the actual program interpolated in the innermost `%_`, which is obtained with `=~/./g` (this returns a list of all the chars that matches the regex, `.` being match-all).
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 1 byte
```
1
```
[Try it online!](https://tio.run/##K0otycxLNPz/H4gMAA "Retina – Try It Online")
Counts the number of 1s in the input, so the output is always 1 or 0.
Inspired by [this answer](https://codegolf.stackexchange.com/a/209330/95792) on a related question.
[Answer]
# [Ruby](https://www.ruby-lang.org/) `-nl`, ~~40...32~~ 28 bytes
```
p~/[,-2\[-\]p~,..011?:]/?2:0
```
[Try it online!](https://tio.run/##Dcm7DsIgAEDR/f5F48rbx8BCW/0LYDFRY2JaYu3QhU8XPet5r9ettVJ1FNKlKFMuVShlrA0@6@C8@S8VTUQgcSgMlkTAkxkYOXPhxp0Hew4cOdHRs/vO5fOcp6XJ6fUD "Ruby – Try It Online")
Derived from my [answer](https://codegolf.stackexchange.com/a/209400/92901) to a related challenge. Each of the 14 distinct characters in the code appears twice. The input is tested against a regexp. The outer `[]` is a character class containing literal characters plus two character ranges: `,-2` is equivalent to the literal characters `,-./012` and `\[-\]` is equivalent to the literal characters `[\]`. The code prints `2` if the regexp matches the input character; `0` is printed otherwise.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 303 bytes
```
n[4467]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,0,3,3,0,0,126,0,0,0,92,15,17,2,2,2,2,2,0,1,0,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,2,0,0,0,2,0,1,1,1,1,1,1,2,0,0,0,1,5,0,1,0,2,0,2,0,0,0,0,0,0,2,0,2};main(){printf("%d\n",n[getchar()]);}
```
[Try it online!](https://tio.run/##S9ZNT07@/z8v2sTEzDzWttpAh3JoBCYNwaQxEIJ5RmZQWUsjHUNTHUNzoDIYhCg2gmsi11pDqNUwsxAQJm6oY4pkmxGGs41qrXMTM/M0NKsLijLzStI0lFRTYvKUdPKi01NLkjMSizQ0YzWta///zwUA "C (gcc) – Try It Online")
[Answer]
# [Turing Machine Code](http://morphett.info/turing/turing.html), 95 bytes
I'm not sure this counts, and if so deemed, I'll make it non-competing (or delete it if you guys think it's too egregious). The reasons why have to do with the Turing Machine Code interpreter I'm using. This affects the space character ( ), asterisk (\*), and semi-colon(;).
**Space character**  
Basically it internally converts space characters into underscores '`_`'. Also, it interprets the *lack* of any character as a space character, and therefore interprets that as an underscore. Not only this, but it also interprets an actual underscore '`_`' as an underscore (or space, or lack of a character). Since the input is strictly limited to the text box on the web page, this means there is significant ambiguity as to how to count a space character. ***So that character will not work with this code.*** Any attempts at trying to fudge something here could easily and reasonably be discounted as wrong by atleast 3 different valid interpretations that I can come up with off the top of my head.
**Asterisk**  
This character is set aside for a few special uses, depending on where in the code it's used. Most relevantly for this challenge, the asterisk - when used as an input check - acts as a special catch-all character. So any attempt at trying to catch this as input, catches anything and everything, including the aforementioned space character. It does so without any ability to discern an actual asterisk from the infinite possibilities. ***So that character will not work with this code.***
**Semicolon**  
Lastly, the semicolon is a **very strict** line comment. You put that anywhere in that line of code, and that's it. Everything after it (inclusive) on that line is interpreted as a comment, and is ignored. As a result of this, this Turing Machine interpretor will never be able to 'read' the semicolon character '`;`'. ***So that character will not work with this code.***
```
0 0 1 r 0
0 _ 2 * 2
0 r 7 * r
0 7 3 * r
0 2 7 * 2
0 3 5 * r
0 1 2 * r
0 5 3 * r
0 * 0 * 2;3325_
```
[Try it online!](http://morphett.info/turing/turing.html?91b32d1afa58fdd26d2f2cd693603457)
I'm deeply suspicious that there is a two or three line solution to this. I'll probably play around with this for a bit some more. Having to use a comment to pad the numbers really sets off a flag in my head that this code could accomplish this task far more efficiently.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 16 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
"UèiQÑ )"iQ èU)Ñ
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=IlXoaVHRICkiaVEg6FUp0Q&input=J1Un)
Takes inspiration from the normal Japt quine. Essentially, counts the number of occurences in the string at the beginning (with a quote), then doubles it.
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), 144 bytes
```
[S S S N
_Push_0][S N
S _Duplicate_0][S N
S _Duplicate_0][T   N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve_input][S N
S _Duplicate][S S S T   S S S S S N
_Push_32][T S S T   _Subtract][N
T   S S N
_If_0_Jump_to_Label_SPACE][S N
S _Duplicate][S S S T   S S T   N
_Push_9][T  S S T   _Subtract][N
T   S T N
_If_0_Jump_to_Label_TAB][S S S T    S T S N
_Push_10][T S S T   _Subtract][N
T   S S T   N
_If_0_Jump_to_Label_NEWLINE][N
S N
N
_Jump_to_Label_PRINT][N
S S S N
_Create_Label_SPACE][S S S T    S S T   S T T   N
_Push_75][N
S N
N
_Jump_to_Label_PRINT][N
S S T   N
_Create_Label_TAB][S S S T  S S S S T   N
_Push_33][N
S N
N
_Jump_to_Label_PRINT][N
S S S T N
_Create_Label_NEWLINE][S S S T  S S T   S S N
_Push_36][N
S S N
_Create_Label_PRINT][T  N
S T _Print_as_integer_to_STDOUT]
```
Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.  
`[..._some_action]` added as explanation only.
[Try it online](https://tio.run/##TYxBCoBADAPPySvyNZEF9yYo@Pyadl2VhkKGIdfWz3bsy9oiJNHngBCALBLyyaTwUIpiMrAAPgm0RtbicL032aPrr@H1lJ3uiOAN) (with raw spaces, tabs and new-lines only).
**Explanation in pseudo-code:**
```
Character c = STDIN as character
If(c == ' '):
  Print 75 to STDOUT
Else-if(c == '\t'):
  Print 33 to STDOUT
Else-if(c == '\n'):
  Print 36 to STDOUT
Else:
  Print 0 to STDOUT
```
This sounds pretty straight-forward, but it was reasonably tricky to get the correct numbers. Pushing a number in Whitespace is done as follows:
* `S`: Enable Stack Manipulation
* `S`: Push number
* `S`/`T`: Positive/negative respectively
* Some `T`/`S` followed by a single `N`: Decimal as binary, where `T` is 1 and `S` is 0
So, after I created the template of my program, the amount of newlines were fixed and I could simply print 36 in that case.  
But the amount of spaces and tabs are variable. If I correct the count-output of the amount of spaces, the tabs would be incorrect, and vice-versa. This required some tweaking, which I eventually did without wasting any bytes by using a Label `ST` for the `Label_NEWLINE`. Usually I create Labels in the following order, based on the amount of times it's used: (empty label); `S`; `T`; `SS`; `ST`; `TS`; `TT`; `SSS`; etc. In this case, I've skipped the `SS` and used `ST` instead, allowing me to print 75 and 33 with the binary pushes of `TSSTSTT` and `TSSSST` for the counts of spaces and tabs respectively.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), ~~12~~ 8 bytes
```
`I$O`I$O
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiYEkkT2BJJE8iLCIiLCJJXG5PXG5gXG5LXG4kIl0=)
Back then, there was no quine cheese. Now there is.
## Explained
```
`I$O`I$O
`I$O`    # The string "I$O"
     I   # surrounded in backticks and appended to itself
      $O # Get the count of the input in that.
```
]