text:
Alphabet Position Finder
Inspired by the Codewars Kata.
Your goal is to take an input string such as this one:
"'Twas a dark and stormy night..."

and return a string containing the position of each character in the alphabet, separated by spaces and ignoring non-alphabetical characters, like this:
"20 23 1 19 1 4 1 18 11 1 14 4 19 20 15 18 13 25 14 9 7 8 20"

For an additional challenge, you can replace any numerical characters in the original string with themselves + 27. For example, "25" would become "29, 32". This is completely optional.
You must use 1-indexing ('a'==1, 'b'==2, etc)
Additional rules:

You must return a string, not an array.
Trailing whitespace is OK.

The winner has the lowest byte count.
Good luck!

closely related

@TheoC Is that mandatory or not? It says we should ignore every non-letter but then that we should replace numerical characters?

@TheoC Why? The general consensus is that answers should be able to output in any reasonable format, as it may add too much bloat and make it unfair to languages who can join by spaces in a shorter way.

@TheoC Why don't you just allow both?

Can the input contain any of [\]^_`  (ascii 91 to 96)?

2.Separate question: can it contain any of {|}~ (ascii 123 to 126)?

Welcome to PPCG! This is a decent challenge overall, but for next time you post a challenge, here are some things to keep in mind. 1) This challenge is pretty simple. I think it would be more interesting if the optional part was mandatory (note, don't change that part now, it's too late). 2) You're pretty restrictive about some arbitrary parts. Why not allow an array? It's our standards than an array of characters is a string. I would recommend reading through this thread for ideas.

Future notes: 1 and 0 indexing are usually one and the same, and both are usually allowed. Also, constraining output formats is frowned upon. If it's a list of values let the language decide the format. The challenge isn't about formatting output nor is it about shifting indices. Therefore, it shouldn't be a constraint when you could just allow languages to do what they'd do naturally and focus on the challenge intent.

Can the input contain any non-ascii characters like Э?

05AB1E, (5?) 7 bytes
Rightmost two bytes are output formatting
áÇ32%ðý

A port of my Jelly answer, but O5AB1E is more terse for the alphabet filtering.
Try it online!
How?
áÇ32%ðý - take input implicitly
á       - filter keep alphabetical characters
 Ç      - to ordinals
  32    - thirty-two
    %   - modulo (vectorises)
     ð  - push a space character
      ý - join

Since OP want it to be printed split by spaces, a trailing ðý can be added. But since halve of the answers output lists I guess just leave it for now.

Ah. I have missed it in my answers...

Java 8, 82 78 72 69 62 bytes
s->{for(int c:s)System.out.print(c>64&~-c%32<26?c%32+" ":"");}

-13 bytes thanks to @OlivierGrégoire.
Try it online.
Explanation:
s->                    // Method with character-array parameter and no return-type
  for(int c:s)         //  Loop over its characters as integers
    System.out.print(  //   Print:
     c>64&~-c%32<26?   //    If the current character is a letter:
      c%32+" "         //     Print the position in the alphabet with a trailing space
     :                 //    Else:
      "");}            //     Print nothing

s->s.chars().forEach(c->{if(c>64&~-c%32<26)System.out.print(c%32+" ");}) (72bytes).

@OlivierGrégoire Thanks! And -3 more bytes by changing it to a ternary if. :)

s->{for(int c:s)System.out.print(c>64&~-c%32<26?c%32+" ":"");} (62 bytes) using a char[] as input instead of a String.

R, 55 50 bytes
cat(utf8ToInt(gsub("[^A-Za-z]","",scan(,"")))%%32)

Try it online!
Reads input from stdin, converts to uppercase, removes non-uppercase alphabetic letters, converts to code points, subtracts to 64 mods by 32, and prints to stdout, separated by spaces.
Thanks to Kevin Cruijssen for the golf!

50 bytes

@KevinCruijssen * facepalm * duh

I have added two comments(questions) to the question - depending on the answer there is an opportunity to golf this down to 46 or even 39 chars.

You can do 47 by using [^A-z]

Python 3, 62 60 49 bytes
-5 bytes thanks to Jo King.
-8 bytes thanks to pLOPeGG.
After these improvements, this answer is now similar to Jonathan Allan's answer.
print(*[ord(c)%32for c in input()if c.isalpha()])

Try it online!

Oh, I guess %32 works as well

APL (Dyalog Unicode), 24, 20, 14 13 bytes
-4 bytes thanks to Zacharý (and Mr. Xcoder)!
-6 bytes thanks to Adám!
-1 byte thanks to ngn!
⎕A⍳⎕A∩⍨≡819⌶⊢

Try it online!
Explanation:
        ≡819⌶⊢  - to uppercase
   ⎕A∩⍨         - intersect with the letters A-Z (args swapped to preserve the order)
   ⍳              - index in
⎕A               - the A-Z letters list

My initial solution:
APL (Dyalog Unicode), 24 20  bytes
{⍵/⍨27>⍵}⎕A⍳1(819⌶)⊢

Try it online!
Explanation:
             ⍳           indices of
              1(819⌶)⊢  the right argument (⊢) changed to uppercase
          ⎕A            in the list of uppercase letters
{⍵/⍨     }              copy (filter) those items from the list of indeces
     27>⍵               which are smaller than 27 (all non A-Z chars will have index 27)

Don't laugh at me, I'm new to APL :)

That's actually remarkably good for someone new to APL! You don't need the parentheses, they're assumed. Also,{1(819⌶)⍵} can be 1(819⌶)⊢. Otherwise, amazing job! Hope you enjoy APL in the future!

@Zacharý Thanks! I hope so (I have some knowledge in J , I'm not totally new into array languages)

As Zachary noted, the parentheses are assumed, so you needn't include them into the byte count, resulting in 20 bytes.

@Mr. Xcoder Oh, I thought it was about the inner ones. Thanks!

Galen, I was thinking of doing this challenge in J, but the verbosity of capitalizing or lowercasing  stopped me.  Would you mind proving an explanation of your solution... I'm curious if it can be translated to J?

@Jonah I added an explanation. You're right, capitalizing and the alphabet itself cost much more in J.

Nice job! You can save a byte by composing the 1 to the 819⌶ and save five by removing 27s directly: 27~⍨⎕A⍳819⌶⍨∘1; or take the intersection with the alphabet: ⎕A⍳⎕A∩⍨819⌶⍨∘1

@Adám Thanks, nice solutions! I should have found the first one by myself, because this is something that can be done the same way in J :)

@GalenIvanov Interesting that J lacks set operations so badly where Dyalog APL also has A∪B, A∩B, and A~B.

@Adám Yes, it's true. I'm only aware of -. (Less) - subtraction / difference. Intersection is achieved by ([-.-.)

@GalenIvanov And union would be ([,-.~)

819⌶⍨∘1 -> ≡819⌶⊢, abusing the fact that the depth (≡) of a character vector is always 1

JavaScript (Node.js), 69 55 54 bytes
t=>t.match(/[a-z]/gi).map(i=>parseInt(i,36)-9).join` `

Try it online!
Explanation :
t =>                       // lambda function accepting a string as input
    t.match(/a-z/gi).      // returns all parts of string that match as an array
        map(i=>            // map over that array with argument i
            parseInt(i,36) // convert to base 36
                - 9        // and subtract 9 from it
        ).                 // end map
        join` `            // convert to space separated string

11 bytes saved thanks to @Kevin
1 more bytes thanks to @Neil

You can add support for numericals for some additional bytes (thanks to @neil)
JavaScript (Node.js), 62 bytes
t=>t.match(/[^_\W]/g).map(i=>(parseInt(i,36)+26)%36+1).join` `

Try it online!

-11 bytes by changing a-z to A-Za-z and i.toLowerCase().charCodeAt()-96 to i.charCodeAt()%32

parseInt(i,36)-9 saves another byte.

.match(/[^_\W]/g).map(i=>(parseInt(i,36)+26)%36+1) lets you support numbers, not sure if that's the best way though.

Python 2, (45?) 55 bytes
11 bytes added to format the output, which also makes this incompatible with Python 3)
lambda s:' '.join(`ord(c)%32`for c in s if c.isalpha())

Another port of my Jelly answer.
Try it online!

Non-formatted version (returning a list of integers):
lambda s:[ord(c)%32for c in s if c.isalpha()]

It looks like OP is insisting on string output separated by spaces, unfortunately

Yep - I missed that on all my answers - one becomes so accustomed to the norms of the site!

Japt v2.0a0 -S, 12 10 bytes
r\L ¬®c uH

Try it

Explanation
r              :Remove
 \L            :  Non-letter characters
    ¬          :Split to array
     ®         :Map
      c        :  Character code
        u      :  Modulo
         H     :  32
               :Implicitly join with spaces and output

Jelly, (7?) 8 bytes
Rightmost byte is output formatting
fØẠO%32K

A full program accepting a string in Python format which prints the result to STDOUT
Try it online!
How?
fØẠO%32K - Main Link: list of characters (created from the string input)
 ØẠ      - yield the alphabet = ['A','B',...,'Z','a','b',...,'z']
f        - filter keep (discard non alphabet characters)
   O     - ordinals          ('A':65, 'Z':90, 'a':97, 'z':122, etc.)
     32  - literal thirty-two
    %    - modulo            (65:1,   90':26,  97:1,  122:26,  etc.)
       K - join with spaces (makes a list of characters and integers)
         - implicit print

Whitespace, 152 117 bytes
-35 bytes thanks to @Lynn.
[N
S S N
_Create_Label_LOOP][S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   S _Read_STDIN_as_character][T   T   T   _Retrieve][S N
S _Duplicate_input][S S S T S S S S S N
_Push_32][T S T T   _Modulo][S N
T   _Swap_top_two][S S S T  T   T   T   T   T   N
_Push_63][T S T S _Integer_divide][T    S S N
_Multiply][S N
S _Duplicate][S S S T   T   S T T   N
_Push_27][S T   S S T   N
_Copy_1st][S S S T  N
_Push_1][T  S S S _Add][T   S T S _Integer_divide][T    S S N
_Mulitply][N
T   S N
_If_0_Jump_to_Label_LOOP][T N
S T _Print_as_number][S S S T   S S S S S N
_Push_32_space][T   N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Start LOOP:
  Character c = STDIN as character
  Integer n = (c modulo-32) * (c integer-divided by 63)
  Integer m = 27 integer-divided by (n + 1) * n;
  If(m == 0):
    Go to next iteration of LOOP
  Else:
    Print n as integer to STDOUT
    Print a space to STDOUT
    Go to next iteration of LOOP

I don't have the time to write it in Whitespace, but maybe you could write something like this

Looks like that's 117 bytes! (*I changed 64 to 63 in the code, as it's equivalent but shorter to represent in Whitespace) :)

@Lynn Not bad, -35 bytes right there. Thanks. :)

Stax, 9 10 9 bytes
üpÉÿ%}},√

Run and debug it
-1 byte thanks to @recursive
Explanation:
v{VaIvm0-J Full program, unpacked, implicit input
v          Lowercase
 {    m    Map:
  VaI        Index in lowercase alphabet (0-based, -1 for not found)
     ^       Increment
       0-  Remove zeroes
         J Join by space
           Implicit output

Stax, 7 bytes
É▌Xl»↔"

Run and debug it
This one outputs newline-separated. Unpacked: vmVaI^|c. Similar, but with map, which implicitly outputs with trailing newline.

Hm. There appears to be a problem packing programs that end in space

@recursive Oh, didn't notice that (usually I try the links, but apparently I forgot it here). I added a workaround.

I never noticed this bug either.  I'll fix it in the next release of Stax.  Existing packed programs will remain unchanged.

Here's a 9 back for your trouble.

x86 opcode, 35 bytes
0080h: AC 3C 24 75 04 88 45 FF C3 0C 20 2C 60 76 F1 D4
0090h: 0A 0D 30 30 86 E0 3C 30 74 01 AA 86 E0 AA B0 20
00a0h: AA EB DD

f:  lodsb
    cmp al, '$'
    jnz @f
        mov [di-1], al
        ret
    @@:
    or al, 32
    sub al, 96
    jbe f
    aam
    or ax, 3030H
    xchg ah, al
    cmp al, 48
    jz @f
        stosb
    @@:
    xchg ah, al
    stosb
    mov al, 32
    stosb
    jmp f

Assuming the result contain at least one letter, and no {|}~
40 bytes, allowing all ASCII chars
0080h: AC 3C 24 75 04 88 45 FF C3 0C 20 2C 60 76 F1 3C
0090h: 1A 77 ED D4 0A 0D 30 30 86 E0 3C 30 74 01 AA 86
00a0h: E0 AA B0 20 AA EB D9

What's "x86 opcode"? Is this just an x86 machine code submission?

@Jakob true. I here don't say ".COM" cuz it's a function and don't rely on ".COM" format

Hmm. Yeah, I think it's assumed that machine code solutions don't have to be complete executables. Might actually be better to just label it "x86 machine code"

05AB1E, 14 bytes
Handles numbers as well
žKÃlvžKlÙyk>ðJ

Try it online!

05AB1E, 8 bytes
láÇ96-ðý

Try it online!
or, if we can return an array:
05AB1E, 6 bytes
láÇ96-

Explanation:
l         Lowercase
 á        Only letters
  Ç       Codepoints
   96-    Subtract 96.

Try it online!
or if you want it to count numbers:
05AB1E, 13 bytes
lAžh«DŠÃSk>ðý

Try it online!

Charcoal, 21 bytes
≔⁺β⭆χιβＦ↧Ｓ¿№βι«Ｉ⊕⌕βι→

Try it online! Link is to verbose version of code. Explanation:
≔⁺β⭆χιβ

Append the digits to the predefined lowercase letters variable.
Ｆ↧Ｓ

Loop over the lowercased input.
¿№βι«

If the current character is a letter or digit,
Ｉ⊕⌕βι

print its 1-indexed index,
→

and leave a space for the next value.

PHP, 70 bytes
for(;$c=$argv[1][$i++];)if(($c=ord($c))>64&($c%=32)>0&$c<27)echo"$c ";

Try it online!
-5 bytes thanks to Kevin

Snippets aren't allowed as submissions here, but you can make it a function or a full program.

Sorry, now it uses the first argument as input

Hi, welcome to PPCG! If you haven't already, tips for golfing in PHP and tips for golfing in  might be interesting to read through. As for parts you can golf: && can be &, and ord(strtolower($c))-96 can be ord($c)%32. Also, I think you can remove the ~ before $c, but I'm not sure. Haven't programmed much in PHP, and don't really know what the ~ is used for right here anyway.

Thanks for your input. Mod 32 is a good idea. It saves some bytes but requires an additional check to make sure ord($c) is bigger than 64.

Red, 93 bytes
func[s][a: charset[#"a"-#"z"]parse lowercase s[any[copy c a(prin[-96 + to-char c""])| skip]]]

Try it online!

I don't know enough about Red, but can #"a"-#"z" be changed to both lower and uppercase letters; and then the lowercase can be removed; and -96 + to-char c can be modulo-32? Not sure if that even saves bytes In Red, though.

@Kevin Cruijssen Thanks, I'll try it later

@KevinCruijssen parse function collects strings even when the match is a single character, that's why I always need the to-char. For the uppercase letters I would need to add to the charset #"A"-#"Z", which spoils the gain (if any) from eliminating lowercase.

Yeah, I was kinda afraid #"A"-#"Z" might not gain much in comparison to lowercase, since it's only 1 byte shorter. And I knew you'd need the to-char, just wasn't sure if -96 +  and modulo-32 would be similar in size.

Perl 5, 47 bytes
With additional challenge of parsing digits:

print map{(ord(uc)-64)%43," "}<>=~/([A-Z\d])/gi

Try it online!
Reduced to 38 bytes by ignoring digits
print map{ord()%32," "}<>=~/([A-Z])/gi

Japt 2.0 -S, 9 bytes
f\l ®c %H

Run it online
Explanation:
f\l ®c %H                                    Input: "Hello..."
f            Match:
 \l             [A-Za-z]                     ["H","e","l","l","o"]
    ®        Map Z over the results:
     c         char-code of Z                [72,101,108,108,111]
       %H      mod 32                        [8,5,12,12,15]
-S           Join the chars with a space     8 5 12 12 15

Perl 5 -p, 35 bytes
$_="@{[map{(-64+ord uc)%43}/\w/g]}"

Try it online!
Includes the extra portion about the digits.

/\w/ includes _

Much smaller than what I'd been playing with! You can save one byte, and fix the bug @BradGilbertb2gills mentioned, using -F/[^0-9\pL]|/: Try it online!

PHP 108 105 Bytes
Try it online (108 Bytes)
Tri it online (105 Bytes)
-3 Bytes, thanks to @manassehkatz
  (Change the level of strtolower and remove A-Z from regex)
Code, tried to avoid any loop
<?=strtr(implode(" ",str_split(preg_replace(
"/[^a-z]/",'',strtolower($argv)))),array_flip(range("`",z)));

Explanation
$string = preg_replace("/[^a-z]/",'',strtolower($argv))
//the string only contains letters

$string = implode(" ",str_split($string));
//the string has a space after every letter

$string = strtr($string, array_flip(range("`",z)));
//replace every letter   acording to the array

$replacementArray = array_flip(range("`",z));
//this array contains the ansi characters from "`" to the "z"
//array_flip to change the keys with the values
//final array ["`"=>0,"a"=>1, "b"=>2...."z"=>26]

In order to get this to run without Warnings, I had to (a) change $argv to $argv[1] and (b) add " around the last z. But with or without those changes (which might be version dependent - I am using 5.6), you can save 3 bytes by moving the strtolower() in a level strtolower($argv) and remove capital A-Z from the regex.

On php 7 it trows a warning, im gonna modified the answer now. I am sorry just no wi had time to check :-D

@manassehkatz Taked your suggestion, and saved 3 Bytes, thanks a lot.

Shouldnt that be $argv[1] or $argn instead of $argv?. join is 3 bytes shorter than implode.

Perl 6, 32 bytes (alpha), 41 bytes (alpha+digit)
{~(.uc.comb(/<:L>/)».ord X-64)}

Try it (32 bytes alpha)
{~((.uc.comb(/<:L+:N>/)».ord X-64)X%43)}

Try it (41 bytes alpha + digit)
Expanded:
32 bytes alpha
{  # bare block lambda with implicit parameter $_

  ~( # coerce to string (space separated)

      .uc                      # uppercase
      .comb( / <:L > / )\      # get letters as a sequence
      ».ord                    # get the ordinal of each
      X- 64                    # subtract 64 from each
  )
}

41 bytes alpha + digit
{  # bare block lambda with implicit parameter $_

  ~( # coerce to string (space separated)
    (
      .uc                      # uppercase
      .comb( / <:L + :N > / )\ # get letters and numbers as a sequence
      ».ord                    # get the ordinal of each
      X- 64                    # subtract 64 from each
    ) X% 43                    # modulus 43 for each
  )
}

This also matches non-ASCII characters like Э, but I've asked for clarification from the OP on whether the input is ASCII-only or not.

Tcl, 93 bytes
puts [lmap c [split $argv ""] {if [string is alp $c] {expr ([scan $c %c]-64)%32} {continue}}]

Try it online!

Python 2, 110 bytes 104 bytes, with user input
a="abcdefghijklmnopqrstuvwxyz";print" ".join(str(a.index(l)+1)for l in list(input().lower())if l in a)

Try it Online!

Python 2, 105 bytes 104 bytes 96 bytes, where t is predefined:
a="abcdefghijklmnopqrstuvwxyz";print" ".join(str(a.index(l)+1)for l in list(t.lower())if l in a)

Try it Online!
Let's break it down with a more readable version:
alphabet = "abcdefghijklmnopqrstuvwxyz"
foo = [str(alphabet.index(letter) + 1) for letter in list(t.lower()) if letter in alphabet]
print " ".join(foo)

First, we define alphabet as being, well, the alphabet.
Next, we use list comprehension to:

Make a list where each item is a lowercase character from t
For each letter, if it is not in the alphabet, discard it.
If it is, find its index in the alphabet,
add one to it (because we start counting at 1)
and make it a string.

Finally, we join it all together and print it.

Edit: Changed to print (and lost portability) to save bytes and make it work outside a function
Edit 2: Added a version with input() instead of predefined variables
Edit 3: Removed 8 bytes in Solutions 1 and 2 thanks to Jo King

You've got 6 extraneous spaces in your code

@JoKing I found three (after semicolon, surrounding +), where are the others?

Before if,for and " "

You can also remove the [] in the join

Again, welcome to PPCG! FYI by default (i.e. if not explicitly overridden in the question) answer submissions may be functions or full-programs (like your 104 byte version) but not snippets (like your 96 byte version). Here you could submit a version which creates a function which returns the string for 100 bytes :)

a.index() is the same as a.find() in this context for -1 byte. Also str(...) can be replaced by backticks: \a.find(l)+1``.

Python 3, 84 bytes
print(*filter(int,['abcdefghijklmnopqrstuvwxyz'.find(c)+1for c in input().lower()]))

Try it online!

PowerShell, 63 bytes
"$(([char[]]"$args".ToUpper()|%{$_-($_,64)[$_-in65..90]})-ne0)"

Try it online!
(Seems long ...)
Takes input $args, converts it .ToUppercase, casts it as a char-array, feeds that into a for each loop. Inside the loop, we subtract either itself or 64 from the (ASCII int) value, based on whether or not the current value is -in the range 65 to 90 (i.e., it's an ASCII capital letter). Those values are left on the pipeline, and we use a -notequal to eliminate the non-letter values (because they're all zero). Those numbers are encapsulated in a string as the default stringification of an array is to space-separate it, so we get that pretty cheaply. That string is left on the pipeline and output is implicit.

PHP, 61 bytes
works in any PHP version from 4.0.4 to 7.2 (but might cease to work in 7.3)
while(~$c=$argn[$i++])ctype_alpha($c)&&print(ord($c)&31)." ";

Run as pipe with -nr or try it online.

MS-SQL, 133 bytes
SELECT STRING_AGG(ASCII(substring(upper(s),number+1,1))-64,' ')FROM
spt_values,t WHERE type='P'AND substring(s,number+1,1)LIKE'[a-z]'

Per our IO rules, input is taken via a pre-existing table t with varchar field s.
SQL 2017 or later is required. Must also be run in the master database, because I'm taking advantage of a system table called spt_values, which (when filtered by type='P') contains counting numbers from 0 to 2047.
Basically I'm joining a number table with the input string using SUBSTRING(), which returns a separate row for each individual character. This is filtered for only letters using LIKE'[a-z]', then we get their ASCII value and subtract 64. These numbers are joined back into a string using the (new to SQL 2017) function STRING_AGG.

Pyth, 10 bytes
jdfTmhxGr0

I'm pretty sure this can be golfed a little bit...
-2 bytes if I can output as a list, some answers seem to but it's not in the spec
Try it online!

You can remove the last d (jdfTmhGr0, 10 bytes).

Ruby, 41 bytes
->s{s.scan(/\p{L}/).map{|i|i.ord%32}*' '}

Try it online!

[A-z] is too wide, it includes underscores and other stuff.

@GB fixed at no extra cost

C (gcc), 67 bytes
c;f(char*s){for(;*s;)(c=tolower(*s++)-96)>0&c<27&&printf("%d ",c);}

Try it online!
Converts each char to lowercase, offsets its code by -96 and, if it falls in the range of the 1-indexed alphabet, prints the offset code

jq, 45 bytes
[gsub("\\W";"")|explode[]%32|@text]|join(" ")

 gsub("\\W";"")                                # remove non-alpha characters
               |explode[]                      # get decimal values of characters
                         %32                   # get positions in alphabet
                            |@text             # convert back to string
[                                 ]|join(" ")  # join with a space

Try it online

[C (gcc)], 57 56 bytes (printing), 70 69 bytes (printing w/optional), 146 bytes (string)
Thanks to ceilingcat for the && optimization.
f(char*s){for(;*s;s++)isalpha(*s)&&printf("%d ",*s&31);}

Try it online!
This version takes alphanumeric text per the additional challenge:
f(char*s){for(;*s;s++)isalnum(*s)&&printf("%d ",(*s<65)*10+(*s&31));}

Try it online!
If returning a string is required for this challenge:
char*f(s,t,u,i)char*s,*t,*u;{for(i=strlen(s)*4,t=calloc(i,2),u=t+i;*s;s++)isalnum(*s)?sprintf(u,"%d ",(*s<65)*10+(*s&31)),strcat(t,u):0;return t;}

Try it online!

CJam, 23 15 bytes
qel_eu-{i32%S}/

Try it online!
Saved 8 bytes thanks to Esolanging Fruit

q{el_eu-},{i32%S}/ works.

Nice solution! I managed to golf it down a bit more

ABAP, 228 bytes, letters only
I wrote a FORM subroutine for an ABAP report. i is input, o is output.
FORM h USING i o.TRANSLATE i TO UPPER CASE.DO strlen( i ) TIMES.data c(2).c = sy-index - 1.FIND i+c(1) IN 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' RESULTS data(r).CHECK sy-subrc = 0.c = r-offset + 1.CONCATENATE o c ` ` INTO o.ENDDO.ENDFORM.

Verbose code:
Look at it on Pastebin.com for syntax highlighting. (Not that it looks much better)
"This stuff is used to actually run the program, call the form and output the results.
REPORT z.
PARAMETERS se_input TYPE string.
START-OF-SELECTION.
    DATA ret type string.
    PERFORM h USING se_input ret.
    WRITE ret.

"---- CODE STARTS HERE ----
FORM f USING i o.              "Two parameters: i for input, o for output.
    TRANSLATE i TO UPPER CASE. "All to uppercase
    DO strlen( i ) TIMES.      "Do for each character
        data c(2).             "A char field, length of 2
        c = sy-index - 1.      "Current loop index - 1 = index in string. Loop index starts at 1.
        FIND i+c(1)            "Find substring: input at position index, length 1...
         IN 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' RESULTS data(r). "...in the alphabet, save to "r"
        CHECK sy-subrc = 0.    "sy-subrc <> 0 => not in the alphabet, skips the rest of this loop (same as CONTINUE)
        c = r-offset + 1.      "r-offset is the index in the string, add one for alphabet position
        CONCATENATE o c ` ` INTO o. "Concatenate it all into the output chars, including the literal space.
                  "      ^- had I used ' ' here, CONCATENATE would remove blank space, but ` ` stays untouched.
    ENDDO. "Loop end
ENDFORM.   "FORM end

Notes, thoughts, background stuff
First of all, no, I did not miss spaces in my code. ABAP wants them and will not run without them...
The USING parameters i and o are of unknown type, so the program calling the FORM must use a string (or char field with at least length of input * 3: 2 characters + space per letter) for o, otherwise results can be cut off or it all just dumps right away if it's a numeric value for example.
I saved a few bytes here by re-using the same character field over and over again, abusing the fact that ABAP implicitly converts numbers to chars and vice versa without any issues. This is especially better than using the CONDENSE <var> statement, which was initially necessary to not have my integers padded to 26 characters width.
Getting substrings in ABAP is super quick and easy once you get used to it:
substring = string+offset(length).
Thanks to the implicit conversion, offset can be even a character field. Nasty, but great for us in this case. But be careful: While string+5 gives you the substring starting from index 5, string + 5 will try to cast your string to a number and add 5. Spaces matter!
There's also an easy way to convert the character to a byte value, giving me the ASCII code and removing the need to do the lengthy FIND IN ... stuff, but on a Unicode SAP system there's no quick and dirty way to convert that byte value into a "readable" number that I know of, so it's kind of a red herring.
By the way: TRANSLATE i TO UPPER CASE. is exactly 26 bytes long, so at first glance it looks like we don't even need it and can just add the lowercase letters to the alphabet string instead. But you probably realized right away why we can't do that. ;-)

Bonus:
ABAP, 238 bytes, alphanumeric
For the alphanumeric version we just add 0123456789 to the alphabet string, hence increasing the length of the code by 10 bytes. Not very interesting, but any other approach would just be longer thanks to the very, uhm, verbose language that ABAP is.
FORM h USING i o.TRANSLATE i TO UPPER CASE.DO strlen( i ) TIMES.data c(2).c = sy-index - 1.FIND i+c(1) IN 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' RESULTS data(r).CHECK sy-subrc = 0.c = r-offset + 1.CONCATENATE o c ` ` INTO o.ENDDO.ENDFORM.

I hope my explanation is somewhat interesting. Thanks for the challenge!

Haskell, 63 bytes
import Data.Char
unwords.map(show.(`mod`32).ord).filter isAlpha

Try it online!

Currently this only converts uppercase letters, you need isAlpha instead of isUpper.

@Laikoni I don't know how I failed to notice that...

62 bytes and a less insane header: Try it online!

Ruby, 97 bytes
n=[];gets.chomp.gsub(/[^a-zA-Z]/,'').upcase.bytes.each{|i|n.push i-64};puts n.map(&:to_i).join" "

Try it online!

Lua (5.3), 94 bytes
x=...y=""for i=1,#x do z=x:sub(i,i)y=y..(z:find"%a"and(z:byte()&~32)-64 .." "or"")end print(y)
Try it online!

Thunno 2 Ṡ, 2 bytes
ỊÄ

Try it online!
Explanation
    # Implicit input
Ị   # Keep only alphabetic characters
 Ä  # And get the 1-based indices in the alphabet
    # Implicit output, joined by spaces


text:
Array-of-array string conversion to and from matrix
Matrix challenges are popular. There's an issue of how to provide test cases. A common method is the row-wise array-of-arrays representation, such as:
[[1,2],[3,4],[5,6]] -> a 3 by 2 matrix

This is good with vertical space, but there's always the task of converting the test cases into something your language can use, and vice versa for producing test cases to this format.
So this is a code-golf challenge and also a repository of conversion functions that people can use when trying or composing matrix challenges.
Defining the format
A row string of length m is a comma-separated list of m ≥ 1 numbers, enclosed in square brackets.
A row-wise n×m array-of-arrays string is a comma-separated list of n ≥ 1 row strings of length m enclosed in square brackets with the following whitespace rules:

has no whitespace before the first [ or after the last ], except for an optional trailing newline.
otherwise may contain spaces

The challenge
Produce two* programs/functions in your language:

one which takes a rowwise n×m array-of-arrays string as an input, and outputs the matrix (as implemented in the language.)
another one which takes an n×m matrix (as implemented in the language) as an input and outputs the rowwise n×m array-of-arrays string.

*It is allowed for one program/function to perform both tasks and you can have helper code used by both conversion functions.
Rules

To be clear: the language must support matrices (or something equivalent like 2D arrays - the name is not important) because the output/input of the two tasks needs to be an actual matrix in the language.
This is code-golf.
Fewest total number of bytes (from all functions and any helper code) in each language wins.
If one program or function does both conversions, only count those bytes once.
Standard rules apply/loopholes forbidden.

Test strings
[[1]]
[ [ 1, 2 ], [ 3, 4 ] ]
[[1.2,3.4,5.6],[3,2,1], [10, 11, 12.1]]

Not really possible to provide test matrices.
A non-golfed, possibly not bug-free worked example
I hope this doesn't violate the "don't answer your own question" guideline.
The R function I use to convert from string to matrix
The R function I use to convert from matrix to string
Here's the Sandbox and a related question.

So are either of the inputs actually strings? ("A row string of length m is a comma-separated list...A row-wise n×m array-of-arrays string is a comma-separated list" - I'd expect these to be flat strings as if copied from a challenge).

...i.e. would Python have a valid 7-byte total submission of eval and str? TIO

Can you please add some test cases?

... And a worked example?

@JonathanAllan One input is a string. The other input is a matrix. The term "list" was used colloquially, and not meant to imply any meaning of the word "list" in a programming or computer science sense. I'm happy to use another term.

@Shaggy I can give some example strings for the string-to-matrix conversion. As for worked examples, I could post TIO links to the (non-golfed, and not completely tested) R code I use personally. Is that what you mean?

What does it mean to "output a matrix” if I use STDOUT? Should/can it be a string representation of a matrix?

@LuisMendo the return value of the function/program needs to be a matrix "as implemented in the language". So if whatever gets printed to STDOUT could be used as an input to another function in your language that is expecting a matrix, that's fine.

So, does a list of lists constitute a matrix? If so, then it's really just 4 bytes in Jelly: ŒṘ to return a string, ŒV to eval it. If not, Jelly is out of the question (but that shouldn't really matter, there are still languages which do have a concept of "matrices").

@EriktheOutgolfer I think a list of lists would qualify as "something equivalent" to a matrix, even if it can be more general than a matrix. If your language participates in matrix challenges using lists of lists, that satisfies the spirit of this one.

@ngm My point is: anything output by a program in STDOUT is a string. It cannot be a matrix; only a string representing a matrix. So is that acceptable?

Japt, 30 bytes
F=_OxZ}G=_Oo'[+Zm_'[+Z+']} +']

Try it online!
Function F converts a string into a matrix, and function G converts a matrix into a string.

source: Stack Exchange

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

sort: votes


text:
2 Cats in a Quine
Challenge
Make two programs, A and B, which are both cat programs in the same language. When concatenated, AB (also in the same language) should be a quine.
For example, suppose hello and world are both cat programs in language XYZ. If helloworld is a quine in said language, then your solution is valid.
For those of you unfamiliar with cats and quines, a cat program is one that prints exactly what was given to it via stdin and a quine is a program that prints its own source code.
Scoring and Rules

The total byte count of the concatenated AB program is your score. As this is code golf, the lowest score wins.
Standard loopholes are forbidden
Input must be taken from stdin and output must go to stdout.
The cat programs do not need to take arguments; they only need to copy stdin to stdout.
The quine should work when the program is given no input, but does not have to work correctly (but may) for other inputs.
The quine does not need to terminate, provided it prints exactly its source code once, nothing more.
The quine needs to be at least one byte long.
A and B can be the same program.
BA does not need to be a quine or even a valid program.

I don't think you should have the A and B can be same program rule

@MuhammadSalman My original idea was to have a cat program be doubled to turn into a quine. I just wanted to open the door to easier solutions because I wasn't entirely sure it was possible. Looks like I was wrong on both counts, but I'm fine with that.

You should probably add that AB must be non-empty, since lots of languages have a 0-byte cat allowing for a 0-byte quine.

@DJMcMayhem a 0-byte quine wouldn't be a valid quine though.

What is a cat program?

@Hamsterrific: a program that prints its own input byte-for-byte

V, 2 + 2 == 4 bytes
2i2i

Try the quine!
Try the cat!
A is 2i
B is also 2i
How does it work?
First off, some explanations of how V works. One notable thing that makes this answer possible is that in V, the empty program is a cat program. This isn't a special case, it's inherent to how V operates. On startup, all input is loaded into a "buffer", each command modifies the buffer in someway, and then when the program is done, the buffer is implicitly printed. This means that any string of NOPs is also a cat program.
The i command means enter insert mode, which means every character following an i will be added into the buffer. With a number preceding it, that text will be duplicated n times.
This means that for the cat program, nothing will be added to the buffer, and it will be printed as it was read. In other words:
        " (Implicitly) Load all input
2       " 2 times,
 i      " Insert the following text into the buffer...
        " (nothing)
        " (Implicitly) Print the buffer

But for the quine, there is text after the i:
2       " 2 times,
 i      " Insert the following text into the buffer...
  2i    "   "2i"
        " (Implicitly) Print the buffer

Cheeky non-answer
V, 0 bytes

Try it online!
A is the empty program.
B is also the empty program.
:P

Every other language: Oy, we've hit a dead end!. V: *posts standard quine*.

C# (Visual C# Compiler), 551 bytes
A: 95 bytes
class A{public static int i=2;static void Main(string[]args){System.Console.Write(args[0]);}}//

Try it online!
B: 438 + 18 bytes
class A{public static int i=0;}
class B{static void Main(string[]args){if(A.i<1){System.Console.Write(args[0]);return;}var a=@"class A{{public static int i=2;static void Main(string[]args){{System.Console.Write(args[0]);}}}}//class A{{public static int i=0;}}
class B{{static void Main(string[]args){{if(A.i<1){{System.Console.Write(args[0]);return;}}var a=@{0}{1}{0};System.Console.Write(a,'{0}',a);}}}}";System.Console.Write(a,'"',a);}}

Try it online!
A+B: 533 + 18 bytes
class A{public static int i=2;static void Main(string[]args){System.Console.Write(args[0]);}}//class A{public static int i=0;}
class B{static void Main(string[]args){if(A.i<1){System.Console.Write(args[0]);return;}var a=@"class A{{public static int i=2;static void Main(string[]args){{System.Console.Write(args[0]);}}}}//class A{{public static int i=0;}}
class B{{static void Main(string[]args){{if(A.i<1){{System.Console.Write(args[0]);return;}}var a=@{0}{1}{0};System.Console.Write(a,'{0}',a);}}}}";System.Console.Write(a,'"',a);}}

Try it online!
A and B take input as a command-line argument. A+B ignores any input. 18 bytes on B and A+B are added for the /p:StartupObject=B option sent to MSBuild. It's only strictly necessary on A+B, but it seemed like cheating to not also have it in B. This way, the compiler flags for A+B are the compiler flags for A (none) plus the compiler flags for B.
Explanation
Program A is straightforward. Class A contains an (unused) static variable i initialized to 2, and prints its first argument when run. The // at the end is important for the A+B code, but does nothing in A itself.
Program B is weird in isolation, but essentially the same. It creates a Class A containing a static variable i initialized to 0, and then runs the Main method of Class B, which does the same as Program A because A.i is less than 1, and returns before any of the weird stuff. The newlines aren't necessary here, but are important for A+B.
When combined, the // from Program A comments out the Class A declaration from Program B, but because of the newline Class B is fine, allowing A.i to refer to the 2 value from Program A instead. The Compiler Flag makes the Program run B.Main() since A.Main() also exists. The result is that Program A+B does not output its argument, but instead goes to the following segment of B.Main(), which is basically just the standard C# quine.

"the cat programs...need to copy stdin to stdout"

Ruby, 71 bytes
2;puts (<<2*2+?2)[/.+2/m]||$<.read
2;puts (<<2*2+?2)[/.+2/m]||$<.read
2

Can be broken up into cats as follows:
2;puts (<<2*2+?2)[/.+2/m]||$<.read
2

and
;puts (<<2*2+?2)[/.+2/m]||$<.read
2

The two cats are identical except for the leading 2, which is a no-op in all three programs. The <<2 is a herestring, meaning that everything starting on the next line until a terminating 2 on its own line is a string, which we concatenate to itself (*2) and append a trailing 2. In the cats the herestring is well-formed but empty, so the regular expression won't match it and we'll fall through to the $<.read expression and output STDOUT. Once we concat the cats, though, the string won't terminate until the third line, so the regex matches and we short-circuit and output the quine.

Pyth, 29 bytes (5 + 24) 27 bytes (5 + 22)
pz=T0?TzjN*2]"pz=T0?TzjN*2]     # Quine
pz=T0                           # Cat A
     ?TzjN*2]"pz=T0?TzjN*2]     # Cat B

That was fun.
Try the quine here
Try the first cat here
Try the second cat here
Explanations
Cat A
pz=T0
pz       Print the input.
  =T0    (Irrelevant for cat)

Cat B
?TzjN*2]"pz=T0?TzjN*2]
?Tz                      If T (10) is truthy, output the input.
   jN*2]"pz=T0?TzjN*2]   (Irrelevant for cat)

Quine
pz=T0?TzjN*2]"pz=T0?TzjN*2]
pz                            Print the (empty) input (without a newline).
  =T0                         Set T to 0.
     ?Tz                      If T (0) is truthy, output the input.
             "pz=T0?TzjN*2]   Otherwise, get this string...
          *2]                 ... take two copies...
        jN                    ... and join them with a quote.

Haskell, 116 + 20 = 187 175 174 136 bytes
A bunch of bytes saved since Ørjan Johansen showed me interact
Cat 1
g=";main|idmain<-(++\"g=\"++show g++g)=interact idmain|1>0=interact id";main|idmain<-(++"g="++show g++g)=interact id

Try it online!
Cat 2
main|1>0=interact id

Try it online!
Quine
g=";main|idmain<-(++\"g=\"++show g++g)=interact idmain|1>0=interact id";main|idmain<-(++"g="++show g++g)=interact idmain|1>0=interact id

Try it online!

The basic principle at work here is that when we add the second cat to the first we change the name of the function we are interacting with from a to idmain.  Since interact id is a cat we want idmain to me a function that returns a quine.  The obvious solution would be to use const, however since we can assume the input is empty (++) works as well.
From here we find the source code via pretty standard means, we have a variable g that encodes the source and we use a special wrapper to print it in string form and code form.  There is a slight exception that we need to put our encoder at the front because we already need to end with interact id.  This means an extra g= is not encoded and has to be handled manually.  Our next cat is pretty standard except we need to make it valid code when tacked on to the end of the other cat so we need both cats to be instances of pattern guards.
Alternative Strategy, 43 + 105 = 186 148
Cat 1
g="";main|idmain<-(++g++show g)=interact id

Try it online!
Cat 2
main|1>0=interact id where g="g=\"\";main|idmain<-(++g++show g)=interact idmain|1>0=interact id where g="

Try it online!
Quine
g="";main|idmain<-(++g++show g)=interact idmain|1>0=interact id where g="g=\"\";main|idmain<-(++g++show g)=interact idmain|1>0=interact id where g="

Try it online!

You can shorten that quite a bit by replacing getContents + putStr with interact id. Try it online! (The quine no longer works with non-empty input, which allows using a (++ ...) section for the idmain.)

@ØrjanJohansen Thanks! I didn't know about interact, I guess that's because I rarely do IO stuff with Haskell.  I've editted the post.

Python 3, 286 bytes
My first Python golf and my first quine! Not very elegant, but it works.
Program A (238 bytes)
from atexit import*;s="from atexit import*;s=%r;register(lambda:print(end='b'in globals()and s%%s or open(0).read()));b=0\nif's'not in vars():print(end=open(0).read())";register(lambda:print(end='b'in globals()and s%s or open(0).read()));

(no trailing newline)
Program B (48 bytes)
b=0
if's'not in vars():print(end=open(0).read())

(no trailing newline)
Try It Online

program A
program B
concatenation

Acknowledgments

-24 bytes thanks to Jo King
-82 bytes thanks to Jo King

You can do end=open... and use %r instead of %s to not have to do the newline and quotes

Cool, I switched to %r. Not sure what you mean about the newline though.

Instead of %s to format a newline in, you can just do the literal \n. You can also use ; to split statements instead of \n (except the if needs to be on its own line). % can be escaped in the string by doing %%. The only argument needed to format the string is the string itself, everything else can be striped

Program B (and the text for it) can use locals() to save 2 bytes.

Python 3, 137 78 + 37 = 115 bytes
-22 bytes thanks to Jakque!
Program A:
s='s=%r;exec(s[20:45])#print(end=open(0).read())\nprint(s%%s)';exec(s[20:45])#

Try it online!
And program B:
print(end=open(0).read())
print(s%s)

Try it online!
Make Quine AB!
s='s=%r;exec(s[20:45])#print(end=open(0).read())\nprint(s%%s)';exec(s[20:45])#print(end=open(0).read())
print(s%s)

Try it online!
Only works when input is empty, otherwise it prepends the input to the output.

The double quotes should be single ones.

Crashing is allowed?

@Jakob The question doesn't say that crashing is not allowed, and typically output to STDERR is ignored

Ok, fair enough. Clever shortcuts!

-22 bytes : s='s=%r;exec(s[20:45])#print(end=open(0).read())\nprint(s%%s)';exec(s[20:45])#. The idea is to reuse the print(end=open(0).read()) by executing if from a substring of s. You just have to write exec(s[20:45]) (14 bytes instead of 25). As you write it twice you gain 11+11=22 bytes

C++ (clang), 313 + 102 = 415 bytes
Program A (ends in a newline):
#include<cstdio>
#define Q(x,y)#x,B=#y;x
int c;auto I="#include<cstdio>",A=Q(int main(){if(c)printf("%s\n#define Q(x,y)#x\",\"#y;x\nint c;auto I=\"%s\",A=Q(%s,)\n#ifdef Q\nint n=++c;\n#else\n%s\n%s\n#endif",I,I,A,I,B);else while((c=getchar())>=0)putchar(c);},int c;int main(){while((c=getchar())>=0)putchar(c);})

Program B (does not end in newline):
#ifdef Q
int n=++c;
#else
#include<cstdio>
int c;int main(){while((c=getchar())>=0)putchar(c);}
#endif

Not terribly sneaky, and as usual C++ isn't that great for quining.  I won't be surprised if there are ways to shave bytes here and there off the same idea.  The one little catch is changing the behavior of something after it's been defined, and a dynamic variable initializer with side effect does the trick.  (Can this even be done in C without compiler extensions?)
Try it online: A, B, AB
(The only portability concern I'm aware of is that the program assumes <cstdio> puts names both in the global namespace and in std.)

Befunge-98 (FBBI), 8 + 15 = 23 bytes
A + B: (only works for no input)
+9*5~,#@#@~,9j>:#,_:@#"

Try it online!
A:
+9*5~,#@

Try it online!
B:
#@~,9j>:#,_:@#"

Try it online!

I was wondering if someone would manage a befunge answer. It's too bad this one isn't 2D :-/

@Beefster yeah. The problem is it’s pretty hard to do a 2d Quine. Maybe I’ll work on something though

Attache, 15 + 126 = 141 bytes
A:
AllInput[]|Echo

Try it online!
B:
@{If[_,s.="AllInput[]|Echo@{If[_,s.=%s;;Printf[s,Repr!s],AllInput[]|Echo]es}|Call";;Printf[s,Repr!s],AllInput[]|Echo]es}|Call

Try it online!
A + B:
AllInput[]|Echo@{If[_,s.="AllInput[]|Echo@{If[_,s.=%s;;Printf[s,Repr!s],AllInput[]|Echo]es}|Call";;Printf[s,Repr!s],AllInput[]|Echo]es}|Call

Try it online!
Explanation
Each of the cat program encodes AllInput[]|Echo, which is a simple cat program. B is the main quine phase; alone, it is a vectorized function (through unary @) called with no inputs (being called as |Call). Thus, the first conditional If[_,A,B] executes B, which is simply AllInput[]|Echo.
When A + B is executed, unary @ becomes binary @ due to Echo merging with the lambda:
AllInput[]|Echo@{If[_, ...

Now, this means that the lambda is executed before Echo is. Back to the conditional, this function now has all of STDIN as an argument. So, If[_,A,B] executes A, which is the standard quine framework.

Stax, 16 + 12 = 28 bytes
Cat 1:
"yi|d|ca34b4lr"y

Run and debug it
"yi|d|ca34b4lr"y Full program, implicit input
"yi|d|ca34b4lr"  Push the string
               y Push raw input
                 Implicit output of top item

Cat 2:
i|d|ca34b4lr

Run and debug it
i|d|ca34b4lr Full program, implicit input
i            Don't parse input (prefix directive)
 |d          Push main stack depth, always zero
   |c        Cancel because top item is falsy, and implicitly print
     a34b4lr Never executed

Quine:
"yi|d|ca34b4lr"yi|d|ca34b4lr

Run and debug it
"yi|d|ca34b4lr"yi|d|ca34b4lr Full program
"yi|d|ca34b4lr"              Push the string
               y             Push input
                i            No-op
                 |d          Push main stack depth, i.e. 2
                   |c        Do nothing because top is truthy
                     a       Get the string to the top
                      34     Push 34 (charcode of ")
                        b    Copy both
                         4l  Listify top 4
                           r Reverse
                             Implicit output

Cat 1 :
Lua, 41 bytes
a=io.read;while a(0)do io.write(a(1))end;

Try it online!

Cat 2 :
Lua, 70 bytes
if a then io.input(arg[0])end;a=io.read;while a(0)do io.write(a(1))end

Try it online!

Quine :
Lua, 111 bytes
a=io.read;while a(0)do io.write(a(1))end
if a then io.input(arg[0])end;a=io.read;while a(0)do io.write(a(1))end

Try it online!
io.input(arg[0]) in Cat 2 sets the current file as standard input, and as a result, the cat prints the source code

Welcome to PPCG

You can save one byte in cat 1 by removing the last semi-colon ?

Unfortunately, reading the current file is a standard loophole. But nice try anyway.

><>, 12 +3 = 15 bytes
Program A:
<oi

Try it online!
And Program B:
>i!o|o<}*d3'

Try it online!
Make Program AB:
<oi>i!o|o<}*d3'

Try it online!

Python 3.8 (pre-release), 26 + 71 = 97 bytes
Cat 1 (26 bytes):

id=print(open(0).read());

Try it online!
Cat 2 (71 bytes):
exec(s:='id=print(open(0).read()if id else s[:23]+");exec(s:=%r)"%s)')

Try it online!
Quine = Cat 1 + Cat 2 (97 bytes):

id=print(open(0).read());exec(s:='id=print(open(0).read()if id else s[:23]+");exec(s:=%r)"%s)')

Try it online!
How it works:
Cat 1:

open(0).read reads the STDIN
id=print(...) prints it and returns None which will be stored into id (remember it for later)

Cat 2:

<instructions for cat> if id else <other instuctions> will execute <instructions for cat> because id is a built-in and is evaluated as True.

Quine:

Because of Cat 1, id is now equal to None and <instructions for cat> if id else <other instuctions> will now execute <other instructions>
Because both our program have the same structure for cat, we print the cat part of Cat 2 for quining cat1 : s[:23]+");
Then the programm is just a variant of exec(s:='print("exec(s:=%r)"%s)'), a quine in Pyhton 3.8+

Notes:
Both my cat programs add a trailing new line at the end. I assume that it was accepted since it wasn't frormally banned and since most of the cat challenges accept it.
Otherwise I have a 103 bytes solution which doesn't add trailing newlines:
id=print(end=open(0).read());                                                                           #Cat1
                             exec(s:='id=print(end=open(0).read()if id else s[:27]+");exec(s:=%r)"%s)') #Cat2
id=print(end=open(0).read());exec(s:='id=print(end=open(0).read()if id else s[:27]+");exec(s:=%r)"%s)') #Quine

Try it online!
Bonus:
Here is a solution in 116 bytes which accepts not-empty input for the quine program:
while 1:id or print(input());id=0;                                                                                #Cat1
                                  exec(s:='id or~input(s[36:]+"exec(s:=%r)"%s)\nwhile 1:id or print(input());id=0;') #Cat2
while 1:id or print(input());id=0;exec(s:='id or~input(s[36:]+"exec(s:=%r)"%s)\nwhile 1:id or print(input());id=0;') #Quine

Try it online!

Klein 0XX, 6 + 7 = 13 bytes
Works in 000, 001, 010 and 011.
Note that these answers all contain the unprintible byte 17, or "device control 1".
Cat 1
<:2*@

Try it online!
The < redirects the pointer off the left.  It appears on the right at @ and halts immediately spilling its input as output.
Cat 2
@*2:<"

Try it online!
It immediately encounters @ and halts with no further execution. It outputs the input with no changes.
Quine
<:2*@@*2:<"

Try it online!
Like cat 1 this first encounters < which sends it off the left and onto the right.  But this time on the right we encounter " which puts us into string mode.  This causes us to push the entire program (minus the quote) to the stack backwards.  In order to make things easier for myself this part of the program is a palindrome, so we don't have to reverse it.  Now we just need to add the " at the end.  The program begins with a , which is chosen because multiplying it by 2 gives us ". So we duplicate and multiply by two to make the " and exit at @.

Vyxal ajṠ, 13 + 1 = 14 bytes
A: (Try it Online!)
`:qpw$$`:qpw$

B: (Try it Online!)
$

A + B: (Try it Online!)
`:qpw$$`:qpw$$

Explained
`:qpw$$`:qp      # Modified standard Vyxal quine
           w     # Wrap quine in array, so join on newline works
            $    # Swap the quine and the input

$                # Swap
                 #   If the program is standalone, this does nothing
                 #   If concatenated, this undoes the previous swap and puts the quine at the top

a: Push entire input split on newlines to the top of the stack
j: Join top of stack on newlines and output (undo split from a)
Ṡ: Treat all inputs as strings, so proper output is given for inputs like [] and ""

9 + 1 = 10 bytes in modern vyxal

JavaScript (Node.js), 199 bytes

a=()=>console.log(require('fs').readFileSync(0)+'');a();var a=a||0;b=()=>console.log(require('fs').readFileSync(0)+'');!a?b():c=()=>console.log(`a=${a};a();var a=a||0;b=${b};!a?b():c=${c},c()`),c()

Try it online!
Cat A, 57 bytes

a=()=>console.log(require('fs').readFileSync(0)+'');a();

Try it online!
Cat B, 142 bytes
var a=a||0;b=()=>console.log(require('fs').readFileSync(0)+'');!a?b():c=()=>console.log(`a=${a};a();var a=a||0;b=${b};!a?b():c=${c},c()`),c()

Try it online!

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


text:
Classify a region by its slope
Definitions
The kth ring of a square matrix of size N, where 1 ≤ k ≤ ceiling(N/2) is the list formed by the elements of the kth and (N-k+1)th rows and columns, but without the first and last k-1 elements.
Example:

Matrix:

1 2 3 4 5
6 7 8 9 1
8 7 6 5 4
3 2 1 9 8
7 6 5 4 3

Delimited in rings:

+-------------------+
| 1   2   3   4   5 |
|   +-----------+   |
| 6 | 7   8   9 | 1 |
|   |   +---+   |   |
| 8 | 7 | 6 | 5 | 4 |
|   |   +---+   |   |
| 3 | 2   1   9 | 8 |
|   +-----------+   |
| 7   6   5   4   3 |
+-------------------+

The first ring of the above is 1,2,3,4,5,1,4,8,3,4,5,6,7,3,8,6, the second is 7,8,9,5,9,1,2,7 and the third is 6.
An N by N matrix of positive integers is (for the purposes of this challenge):

concave if all the integers on the kth ring are strictly greater than those on the (k+1)th ring, where k is any integer between 1 and N  (those on the first ring are greater than those on the second, which are in turn greater than those on the third etc.). Example:

4 5 6 4 7   -> because 4,5,6,4,7,4,8,5,5,4,6,5,9,5,5,4 are all higher than
4 3 2 2 4      any of 3,2,2,3,2,3,3,2, which are all higher than 1
5 2 1 3 8
5 3 3 2 5
9 5 6 4 5

flat if all the integers in the matrix are equal. Another example (perhaps redundant):

2 2 2 2
2 2 2 2
2 2 2 2
2 2 2 2

convex if all the integers on the kth ring are strictly lower than those on the (k+1)th ring, where k is any integer between 1 and N  (those on the first ring are lower than those on the second, which are in turn lower than those on the third etc.). Example:

1 2 1   -> because 1 and 2 are both lower than 6
2 6 2
1 2 1

mixed if the matrix doesn't satisfy any of the above criteria. Example:

3 3 3 3 3
3 2 2 2 3
3 2 3 2 3
3 2 2 2 3
3 3 3 3 3

Challenge
Given a square matrix of positive integers of size at least 3, classify it according to the definitions above. That is, output one of four different consistent values based on whether the matrix is concave, flat, convex or mixed.
You can compete in any programming language and can take input and provide output through any standard method and in any reasonable format, while taking note that these loopholes are forbidden by default. This is code-golf, so the shortest submission (in bytes) for every language wins.
Test cases
Here's a bunch of examples for you to choose from – I selected 6 from each category.
Concave
[[3, 3, 3], [3, 1, 3], [3, 3, 3]]
[[2, 3, 4], [5, 1, 6], [7, 8, 9]]
[[19, 34, 45], [34, 12, 14], [13, 13, 13]]
[[3, 4, 3, 4], [4, 2, 1, 3], [3, 1, 2, 4], [4, 3, 4, 3]]
[[4, 5, 6, 4, 7], [4, 3, 2, 2, 4], [5, 2, 1, 3, 8], [5, 3, 3, 2, 5], [9, 5, 6, 4, 5]]
[[7, 7, 7, 7, 7], [7, 6, 6, 6, 7], [7, 6, 5, 6, 7], [7, 6, 6, 6, 7], [7, 7, 7, 7, 7]]

Flat
[[1, 1, 1], [1, 1, 1], [1, 1, 1]]
[[2, 2, 2], [2, 2, 2], [2, 2, 2]]
[[8, 8, 8], [8, 8, 8], [8, 8, 8]]
[[120, 120, 120], [120, 120, 120], [120, 120, 120]]
[[10, 10, 10, 10], [10, 10, 10, 10], [10, 10, 10, 10], [10, 10, 10, 10]]
[[5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5]]

Convex
[[1, 2, 1], [2, 6, 2], [1, 2, 1]]
[[1, 1, 1], [1, 2, 1], [1, 1, 1]]
[[19, 34, 45], [34, 76, 14], [13, 6, 13]]
[[3, 3, 3, 3], [3, 4, 4, 3], [3, 4, 4, 3], [3, 3, 3, 3]]
[[192, 19, 8, 6], [48, 324, 434, 29], [56, 292, 334, 8], [3, 4, 23, 23]]
[[291, 48, 7, 5], [47, 324, 454, 30], [58, 292, 374, 4], [9, 2, 53, 291]]

Mixed
[[1, 2, 3], [4, 5, 9], [6, 7, 8]]
[[10, 14, 21], [100, 8, 3], [29, 2, 19]]
[[5, 5, 5, 5], [5, 4, 4, 5], [5, 4, 6, 5], [5, 5, 5, 5]]
[[3, 3, 3, 3], [3, 1, 2, 3], [3, 3, 2, 3], [3, 3, 3, 3]]
[[12, 14, 15, 16], [12, 18, 18, 16], [12, 11, 11, 16], [12, 14, 15, 16]]
[[5, 5, 5, 5, 5], [5, 4, 4, 4, 5], [5, 4, 6, 4, 5], [5, 4, 4, 4, 5], [5, 5, 5, 5, 5]]

This challenge has previously been posted in the Sandbox. Thanks to those who have given valuable feedback there.

Boy, wouldn't it be nice to have some array-of-array string conversion to/from matrix functions handy to process all those test cases in a variety of languages :)

@ngm Don't you dare think we don't have one already! :P

Jelly,  18 17  16 bytes
I believe there is a lot of potential for this effort to be out-golfed
L‘HạŒỤṀ€IṠQṢ«FE$

A monadic link accepting a list of lists of numbers which returns a list of integers:
Concave ->  [0, 0]
Flat    ->  [-1, 0, 1]
Convex  ->  [-1, 0]
Mixed   ->  [-1, 0, 0]

Try it online! Or see the test-suite.
L‘H could be replaced with the less efficient but atomically shorter JÆm.
How?
L‘HạŒỤṀ€IṠQṢ«FE$ - Link: list of (equal length) lists of numbers
L                - length
 ‘               - increment
  H              - halve
                 -   = middle 1-based index (in both dimensions as the input is square)
    ŒỤ           - sort multi-dimensional indices by their corresponding values
                 -   = a list of pairs of 1-based indexes
   ạ             - absolute difference (vectorises)
                 -   = list of [verticalDistanceToMiddle, horizontalDistanceToMiddle] pairs
      Ṁ€         - maximum of €ach
                 -   each = N/2-k (i.e. 0 as middle ring and N/2 as outermost)
        I        - incremental deltas (e.g. [3,2,2,3,1]->[3-2,2-2,3-2,1-3]=[-1,0,1,-2])
         Ṡ       - sign (mapping -n:-1; 0:0; and +n:1)
          Q      - de-duplicate
           Ṣ     - sort
                 -   = concave:[0, 1]; convex:[-1, 0]; flatOrMixed:[-1, 0, 1]
               $ - last two links as a monad
             F   -   flatten
              E  -   all equal? (1 if flat otherwise 0)
            «    - minimum (vectorises)
                 -   = concave:[0, 0]; convex:[-1, 0]; mixed:[-1, 0, 0]; flat:[-1, 0, 1]

Python 2, 219 216 189 176 bytes
def g(M):A=[sorted((M[1:]and M.pop(0))+M.pop()+[i.pop(j)for j in[0,-1]for i in M])for k in M[::2]];S={cmp(x[j],y[~j])for x,y in zip(A,A[1:])for j in[0,-1]};return len(S)<2and S

Try it online!
Outputs set([1]), set([0]), set([-1]), or False for concave, flat, convex, or mixed, respectively.
Thx for: A whopping 27 bytes from a few optimizations by ovs. And then another 13 bytes afterwards.
The list comprehension A (due to ovs) creates a list of the elements of each ring, sorted.
Next, we compare the max and min values between adjacent rings by looking at the 0th and -1th elements of each sorted list in A. Note that if, for example, M is concave, min of each outer ring must be greater than max of the next inner-most ring; and it then follows that max of each outer ring will also be greater than min of the next inner-most ring.
If M is concave, flat, or convex, the set of these min/max comparisons will have only 1 element from {-1, 0, 1}; if it is mixed, there will be two or more elements.

@ovs: That's pretty col; I saved another byte by turning it into a list comprehension (and thinking that this might be a very useful technique for other similar challenges).

Maybe there is a way to shorten the list comprehension, but a while loop still seems to be shorter: while M:k=M[0]+M[-1];M=M[1:-1];A+=sorted(k+[i.pop(j)for j in[0,-1]for i in M]), (174 bytes)

@ovs: You have omitted ,A=() from your byte count...

I get 174 bytes with A=()

Ah! Apologies, I misunderstood. This is different than your earlier version, which was of the form: while M: A+= (some expression).

Java (JDK 10), 247 232 220 bytes
x->{int i=0,j=x.length,k,m,M,p=0,P=0,r=0;for(;i<j;){for(M=m=x[k=i][--j];k<=j;)for(int q:new int[]{x[i][k],x[j][k],x[k][i],x[k++][j]}){m=m<q?m:q;M=M<q?q:M;}r=i++>0?(k=P<m?3:p>M?1:P==m?2:4)*r!=r*r?4:k:0;p=m;P=M;}return r;}

Try it online!
Outputs:

1 for "concave"
2 for "flat"
3 for "convex"
4 for "mixed"

Ungolfed:
x -> { // lambda that takes in the input int[][]
  int i = 0, // index of right bound of ring
      j = x.length, // index of left bound of ring
      k, // index of row-column-pair in ring
      m, // minimum of ring
      M, // maximum of ring
      p = 0, // minimum of previous ring
      P = 0, // maximum of previous ring
      r = 0; // result
  for (; i < j; ) { // iterate the rings from outside inwards
    // set both min and max to be to top right corner of the ring (and sneakily set some loop variables to save space)
    for (M = m = x[k = i][--j]; k <= j; ) // iterate the row-column pairs of the ring from top-right to bottom-left
      for (int q : new int[] {x[i][k], x[j][k], x[k][i], x[k++][j]}) { // iterate all of the cells at this row-column pair (and sneakily increment the loop variable k)
        // find new minimum and maximum
        m = m < q ? m : q;
        M = M < q ? q : M;
      }
    r = // set the result to be...
      i++ > 0 ? // if this is not the first ring... (and sneakily increment the loop variable i)
              // if the new result does not match the old result...
              (k = P < m ? // recycling k here as a temp variable to store the new result, computing the result by comparing the old and new mins/maxes
                         3
                         : p > M ?
                                 1
                                 : P == m ?
                                          2
                                          : 4) * r != r * r ? // multiplying by r here when comparing because we want to avoid treating the case where r = 0 (unset) as if r is different from k
                                                            4 // set the result to "mixed"
                                                            : k // otherwise set the result to the new result
              : 0; // if this is the first ring just set the result to 0
    // set the old ring mins/maxes to be the current ones
    p = m;
    P = M;
  }
  return r; // return the result
}

217 bytes

JavaScript (ES6), 168 bytes
Returns:

-1 for flat
0 for mixed
1 for convex
2 for concave

f=(a,k=w=~-a.length/2,p,P,i,m,M,y=w)=>k<0?i%4%3-!i:a.map(r=>r.map(v=>Y|(X=k*k-x*x--)<0&&X|Y<0||(m=v>m?m:v,M=v<M?M:v),x=w,Y=k*k-y*y--))|f(a,k-1,m,M,i|M-m<<2|2*(M<p)|m>P)

Try it online!
How?
Minimum and maximum on each ring
We compute the minimum m and the maximum M on each ring.
We test whether a cell is located on a given ring by computing the squared distance from the center of the matrix on each axis. Taking the absolute value would work just as well, but squaring is shorter.
A cell at (x, y) is located on the n-th ring (0-indexed, starting from the outermost one) if the following formula is false:
((Y != 0) or (X < 0)) and ((X != 0) or (Y < 0))

where:

X = k² - (x - w)²
Y = k² - (y - w)²
w = (a.length - 1) / 2
k = w - n

Example: is the cell (1, 2) on the 2nd ring of a 6x6 matrix?
  | 0 1 2 3 4 5   w = (6 - 1) / 2 = 2.5
--+------------   (x, y) --> ( x-w,  y-w) --> ((x-w)²,(y-w)²)
0 | 0 0 0 0 0 0   (1, 2) --> (-1.5, -0.5) --> (  2.25,   0.5)
1 | 0 1 1 1 1 0
2 | 0[1]0 0 1 0   k = w - 1 = 1.5
3 | 0 1 0 0 1 0   k² = 2.25
4 | 0 1 1 1 1 0   X = 2.25 - 2.25 = 0 / Y = 2.25 - 0.5 = 1.75
5 | 0 0 0 0 0 0   ((X != 0) or (Y < 0)) is false, so (1,2) is on the ring

Flags
At the end of each iteration, we compare m and M against the minimum p and the maximum P of the previous ring and update the flag variable i accordingly:

i |= 1 if m > P
i |= 2 if M < p
we set higher bits of i if M != m

At the end of the process, we convert the final value of i as follows:
i % 4  // isolate the 2 least significant bits (for convex and concave)
% 3    // convert 3 to 0 (for mixed)
- !i   // subtract 1 if i = 0 (for flat)

Jelly, 17 bytes
ŒDŒH€ẎUÐeZ_þƝṠFf/

Returns 1 for concave, 0 for flat, -1 for convex, and nothing for mixed.
Try it online!

K (ngn/k), 100 71 69 bytes
{$[1=#?,/a:(,/x)@.=i&|i:&/!2##x;;(&/m>1_M,0)-&/(m:&/'a)>-1_0,M:|/'a]}

Try it online!
returns 1=concave, ::=flat, -1=convex, 0=mixed
(:: is used as a placeholder for missing values in k)

A different strategy, using oK: &/1_`{&/+(y>|/x;y<&/x;,/x=/:y)}':(,/*:'(|+:)\)'-1_(-1_1_+-1_1_)\

@zgrep nice! :) feel free to post as a separate answer and take ideas from mine if you want - for instance it seems my splitting into rings is shorter, but I haven't tried it in oK yet

yes, my ring-split works works in oK

Ooh, that's a very neat ring split! I like it.

oK, 56 bytes
&/1_`{&/+(y>|/x;y<&/x;,/x=/:y)}':{(,/x)@.=i&|i:&/!2##x}@

Based off of ngn's answer.
Try it online!
concave:1 0 0
   flat:0 0 1
 convex:0 1 0
  mixed:0 0 0

no need for @ if you turn everything into one big lambda: {&/1_\{&/+(y>|/x;y<&/x;,/x=/:y)}':(,/x)@.=i&|i:&/!2##x}`

C++17 (gcc), 411 bytes
#import<map>
#define R return
#define T(f,s)X p,c;for(auto&e:r){c=e.second;if(p.a&&!p.f(c)){s;}p=c;}R
using I=int;struct X{I a=0;I z=0;I f(I n){R!a||n<a?a=n:0,n>z?z=n:0;}I
l(X x){R z<x.a;}I g(X x){R a>x.z;}I e(X x){R a==z&a==x.a&z==x.z;}};I
N(I i,I j,I s){i*=s-i;j*=s-j;R i<j?i:j;}auto C=[](auto&&m){I
s=size(m),i=-1,j;std::map<I,X>r;for(;++i<s;)for(j=-1;++j<s;)r[N(i,j,s-1)].f(m[i][j]);T(g,T(l,T(e,R 0)3)2)1;};

A new high score! (at the time of posting, at least) Oh well, it's a bit nifty, but still C++.
Try it online!
Lambda C takes a std::vector<std::vector<int>> and returns 1 for concave, 2 for convex, 3 for flat, or 0 for mixed.
A more legible version of the code, with descriptive identifiers, comments, R->return and I->int written out, etc.:
#include <map>

// Abbreviation for golfing. Spelled out below.
#define R return

// Macro to test whether all pairs of consecutive Ranges in `rings`
// satisfy a condition.
// func: a member function of Range taking a second Range.
// stmts: a sequence of statements to execute if the condition is
//        not satisfied. The statements should always return.
//        May be missing the final semicolon.
// Expands to a statement, then the return keyword.
// The value after the macro will be returned if all pairs of Ranges
// satisfy the test.
#define TEST(func, stmts)                                     \
    Range prev, curr;                                         \
    for (auto& elem : rings) {                                \
        curr = elem.second;                                   \
        // The first time through, prev.a==0; skip the test.  \
        if (prev.a && !prev.func(curr))                       \
        { stmts; }                                            \
        prev = curr;                                          \
    }                                                         \
    return

// Abbreviation for golfing. Spelled out below.
using I = int;

// A range of positive integers.
// A default-constructed Range is "invalid" and has a==0 && z==0.
struct Range
{
    int a = 0;
    int z = 0;
    // Add a number to the range, initializing or expanding.
    // The return value is meaningless (but I is shorter than void for golfing).
    int add(int n) {
        return !a||n<a ? a=n : 0, n>z ? z=n : 0;
        /* That is:
        // If invalid or n less than previous min, set a.
        if (a==0 || n<a)
            a = n;
        // If invalid (z==0) or n greater than previous max, set z.
        if (n>z)
            z = n;
        return dummy_value;
        */
    }

    // Test if all numbers in this Range are strictly less than
    // all numbers in Range x.
    int less(Range x)
    { return z < x.a; }

    // Test if all numbers in this Range are strictly greater than
    // all numbers in Range x.
    int greater(Range x)
    { return a > x.z; }

    // Test if both this Range and x represent the same single number.
    int equal(Range x)
    { return a==z && a==x.a && z==x.z; }
};

// Given indices into a square matrix, returns a value which is
// constant on each ring and increases from the first ring toward the
// center.
// i, j: matrix indices
// max: maximum matrix index, so that 0<=i && i<=max && 0<=j && j<=max
int RingIndex(int i, int j, int max)
{
    // i*(max-i) is zero at the edges and increases toward max/2.0.
    i *= max - i;
    j *= max - j;
    // The minimum of these values determines the ring.
    return i < j ? i : j;
}

// Takes a container of containers of elements convertible to int.
// Must represent a square matrix with positive integer values.
// Argument-dependent lookup on the outer container must include
// namespace std, and both container types must have operator[] to
// get an element.  (So std::vector or std::array would work.)
// Returns:
//   1 for a concave matrix
//   2 for a convex matrix
//   3 for a flat matrix
//   0 for a mixed matrix
auto C /*Classify*/ = [](auto&& mat)
{
    int mat_size=size(mat), i=-1, j;
    std::map<int, Range> rings;

    // Populate rings with the range of values in each ring.
    for (; ++i<mat_size;)
        for (j=-1; ++j<mat_size;)
            rings[RingIndex(i, j, mat_size-1)].add(mat[i][j]);

    // Nested macros expand to
    // Range prev, curr; for ... if (...) {
    //   Range prev, curr; for ... if (...) {
    //     Range prev, curr; for ... if (...) {
    //       return 0;
    //     } return 3;
    //   } return 2;
    // } return 1
    // Note each scope declares its own prev and curr which hide
    // outer declarations.
    TEST(greater, TEST(less, TEST(equal, return 0) 3) 2) 1;
};

I don't think 'nifty' means what you think it means

379 bytes


text:
Help us escape the quine factory! Put messages into quines
I've been enslaved in a quine factory. The other workers and I can't communicate with the outside world, we can only slave away making quines all day. The masters will reject any work that isn't a proper quine. I'll have to put messages into the quines I make to let people know we're trapped here.
The Challenge
Help us make a quine that a message can be inserted into. It should be a quine such that when an arbitrary message is inserted at a certain point in its source, it still acts as a quine. With this we can send messages out and get rescued.
The Spec
Your submission should be source code and the char position at which a message can be inserted. (Eg 'between the double quotes' or 'between char 17 and 18' or 'at the end')
It's OK if your code doesn't work with a null message. You can submit it with a placeholder message. The placeholder message doesn't count against your score.
We should be able to insert a message containing any of at least,
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 0123456789.,!?

Example
The source template:
C1ever_Qu1'm'ne_C0de

Output:
C1ever_Qu1'm'ne_C0de

Score is 19 bytes. The 'm' is not counted because it is the placeholder message.
A message-quine made from the template:
C1ever_Qu1'Help, Im trapped in a quine factory! Please rescue me!'ne_C0de

Output:
C1ever_Qu1'Help, Im trapped in a quine factory! Please rescue me!'ne_C0de

The more of these we can make each day the better, so shortest submission in chars wins.

Print a quine that contains the input is quite related to this as well.

Sorry I'm new here and still learning about quines. How would I add a message to the answers in that question? Seems like every char is very carefully chosen and just typing in some new chars would certainly break those quines.

@JaredK Those quines are not all payload-capable (what you're looking for) but many are so it's not really an extension/modification on the other challenge, only a further specification that does not introduce new competitive aspects for which answers should aim.

@JaredK You can add a comment to answers if you want to "add a message to the answers", but I advise against it because those quines are not all meant to be payload-capable.

By 'add a message' to the answer I meant 'add a message , or payload as you say, to the quine. It seems like people won't find this challenging. But should we change it to be a dupe of the answer that @Giuseppe linked? It seems like the spec for that question and my question are trying to create the same challenge. That seems like a more useful way to mark is as dupe than linking it to the generalized quine challenge


text:
Equal numbers in sub-array
Given an array of numbers with length >=3 and length % 3 == 0
[1, 2, 3, 4, ...]
You will split it in sub-arrays of length 3
[[1, 2, 3], [4, 5, ...], [...
And return an array with

[0] => The amount of cases in the sub-array where all numbers are equal
[1] => In case all numbers in sub-array are not equal, the amount of cases in the sub-array where only 2 numbers are equal

Example and test cases:

Input: [2, 4, 2, 5, 5, 5, 4, 2, 1, 3, 3, 1] output [1, 2]

This is because
[[2, 4, 2], [5, 5, 5], [4, 2, 1], [3, 3, 1]]
  ^     ^    ^  ^  ^               ^  ^
   equal    all equal              equal

so 2 equal and 1 all equal

[3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3]     => [1, 3]
[3,3,3,4,4,4,5,5,5,6,6,6,5,4,3]           => [4, 0]
[3,4,5,6,7,8,9,8,7,6,5,4,3,2,1]           => [0, 0]

This is code-golf, so the shortest answer in bytes win.

PD: Apologies for my English.

The numbers in the test cases are all positive. Is that always the case?

@Dennis No. can be positive and negative numbers.

Octave, 60 52 50 bytes
@(x)sum(sum(~diff(sort(reshape(x,3,[]))))'==[2 1])

Try it online!
Saved 8 bytes thanks to Luis!
Explanation:
Reshapes the input into a matrix with 3 rows, and the appropriate amount of columns. It then sorts each of the columns, and calculates the difference between the elements on different rows. This gives a matrix with two rows, where identical numbers will have a zero, and different numbers will have a positive number. This is negated, so that all equal elements are 1, and all unequal are 0. We then sum each of those columns, giving us one of the three alternatives: 0 = All elements are unequal, 1 = Two elements are equal and 2 = All elements are equal. We then check how many are >1, and how many are exactly ==1.

Jelly,  9  8 bytes
-1 thanks to Dennis (use a new alias for L€, Ẉ)
Q3ÐƤẈċⱮ2

Try it online!

05AB1E, 10 bytes
3ôεÙg}12S¢

Try it online!
Explanation
3ô          # split input into groups of 3
  ε  }      # for each triple
   Ù        # remove duplicates
    g       # and get the length
      12S¢  # count the number of 1s and 2s in the result

JavaScript (ES6), 70 bytes
f=([a,b,c,...d],t=p=0)=>1/a?f(d,t+!(a-b&&a-c?b-c||++p:b-c&&++p)):[t,p]

Try it online!
How?
We recursively extract each triplet [a,b,c] from the input array and update two counters t (three-of-a-kind) and p (pair), using the following formula:
t =
t + !(a - b && a - c ? b - c || ++p : b - c && ++p)

There are 5 possible cases which are detailed below, from 'all equal' to 'all distinct'.
a b c | a-b && a-c | b-c | b-c || ++p | b-c && ++p | t +=
------+------------+-----+------------+------------+------------
4 4 4 | false      | 0   | n/a        | 0          | !0    --> 1
4 4 5 | false      | ≠0  | n/a        | ++p        | !++p  --> 0
4 5 4 | false      | ≠0  | n/a        | ++p        | !++p  --> 0
5 4 4 | true       | 0   | ++p        | n/a        | !++p  --> 0
4 5 6 | true       | ≠0  | ≠0         | n/a        | !(≠0) --> 0

If output can have more than only [0] and [1] indexes "Note: returns a 3-elements array with [0] and [1] returning th appropriate values, and [2] returning a dummy value (the number of 3-lists without any elements in common) . This is totally valid according to the current rules." https://codegolf.stackexchange.com/a/166082/31257 62 bytes a=>a.map(_=>++r[--new Set(a.slice(i,i+=3)).size],r=[i=0,i])&&r

Pyth, 13 14 12 11 bytes
/Lml{kcQ3S2

Try it here
Explanation
/Lml{kcQ3S2
      cQ3        Split the input into groups of 3.
  ml{k           Deduplicate and get the length of each.
/L               Count the number...
         S2      ... of 1s and 2s.

Fails for 3rd test (needs some all-equals AND some two-equal triples)

oK, 17 16 bytes
+/(1 2=#=:)'0N3#

Try it online!
            0N3# /reshape into groups of 3 (see ngn's comment)
  (       )'     /for each group:
        =:       /    make a map from number -> indices
       #         /    count number of keys/values
   1 2=          /    check if the count is equal to 1 or 2
+/               /sum together the columns

For k, the 17 byte version is: +/(1 2=#=:)'0N 3#.

0N 3 -> 0N3 (thanks to a parsing oddity in oK)

R, 70 bytes
function(v,x=lengths(by(v,seq(0,a=v)%/%3,table)))c(sum(x<2),sum(x==2))

Try it online!
Previous versions :
R, 82 bytes
function(v,a=!1:2){for(i in lengths(by(v,seq(0,a=v)%/%3,table)))a[i]=a[i]+1;a[-3]}

Try it online!

R, 93 bytes
function(v,a=table(lengths(by(v,0:(length(v)-1)%/%3,unique)))[c('1','2')])`[<-`(a,is.na(a),0)

Try it online!

Possibly porting the Octave answer will be more efficient, but a=!1:2 is a bit shorter.

@Giuseppe: thanks, and saved other 5 bytes using seq(0,a=v) instead of 0:(length(v)-1) ;) Unfortunately I don't know octave so I cannot read that answer easily...

@Giuseppe : changed approach and saved a lot of bytes :)

Great approach! I had something shorter by applying unique but it fails for the third test case. Your by approach is safer

@JayCe: fortunately R 3.2.0 introduced lengths function that saves a lot of bytes... but they should introduce a shorted lambda functions definition in R, in order to be more competitive in code golf :D

Java (JDK 10), 116 bytes
l->{int r[]={0,0,0},i=0,a,b,c;for(;i<l.length;b=l[i++],c=l[i++],r[a==b?b==c?0:1:b==c|a==c?1:2]++)a=l[i++];return r;}

Try it online!
Note: returns a 3-elements array with [0] and [1] returning th appropriate values, and [2] returning a dummy value (the number of 3-lists without any elements in common) . This is totally valid according to the current rules.

PowerShell, 106 bytes
param($a)for(;$a){$x,$y,$z,$a=$a;if($x-eq$y-and$y-eq$z){$i++}else{$j+=$x-eq$y-or$y-eq$z-or$z-eq$x}}+$i,+$j

Try it online!
Exactly what it says on the tin. Loops over input $a. Each iteration, peels off $x,$y,$z as the next three elements. Tests if they're all equal and if so, increments $i. Else, increments $j if at least one pair is equal. Once the loop is complete, output $i and $j as integers.
So ... many ... dollars ...

Japt, 14 13 bytes
2õ@ò3 x_â Ê¶X

Try it

Explanation
2õ                :Range [1,2]
  @               :Pass each X through a function
   ò3             :  Split input to arrays of length 3
       _          :  Pass each through a function
        â         :    Remove duplicates
          Ê       :    Get length
           ¶X     :    Test for equality with X
      x           :  Reduce by addition

Python 2, 77 72 65 bytes
lambda a:map([len(set(t))for t in zip(*[iter(a)]*3)].count,(1,2))

Try it online!
7 bytes saved via a clever trick from xnor

You can generate the list of triplets shorter as zip(*[iter(a)]*3).

@xnor: Very nice; I wondered if there was a shorter way...

Retina 0.8.2, 68 bytes
(.+)¶(.+)¶(.+)
;$1;$2;$3;$1;
%M`(;\d+)(?=\1;)
s`((1)|(3)|.)+
$#3 $#2

Try it online! Link includes test cases with header to convert to desired format of one value per line. Explanation:
(.+)¶(.+)¶(.+)
;$1;$2;$3;$1;

Collect three values onto each line with separators and duplicate the first one at the end.
%M`(;\d+)(?=\1;)

Count the number of pairs of duplicates.
s`((1)|(3)|.)+
$#3 $#2

Count the number of 3s and 1s.

Stax, 8 bytes
íUÖ←#"ë╕

Run and debug it

J, 16 15 bytes
-1 byte thanks to cole!
1#.1 2=/_3#@=\]

Try it online!
Pretty much the same approach as the majority of solutions.
Explanation:
        _3    \]  - split the input into sublists of lenght 3
          #@~.    - for each triplet remove duplicates and take the length
   1 2=/          - compare with 1 and 2
1#.               - add up

#@~. -> #@=

Common Lisp, 113 bytes
(lambda(l &aux(a 0)(b 0))(loop for(x y z)on l by #'cdddr do(if(= x y z)(incf a)(if(/= x y z)()(incf b))))`(,a,b))

Try it online!
Used the fact that in Common Lisp (= x y z) gives true if all the three elements are equal, and (/= x y z) gives true if no pair of numbers is equal.

Retina, 23 bytes
S2,3,`
%Cq`\S+
*\C`1
2

Try it online!
Explanation
S2,3,`

Split the input at every 3rd space starting at the (0-based) 2nd, i.e. split the input into groups of three.
%Cq`\S+

On each line (%) count the number (C) of unique (q) values (\S+).
*\C`1

Count the number of 1s and print them with a trailing linefeed (\), but do so in a dry-run (*) so that we don't lose the previous result.
2

Count the number of 2s (and print them automatically).

Wolfram Language (Mathematica), 49 bytes
Saved two bytes thanks to Martin Ender.
{#~Count~{_},#~Count~{_,_}}&@BlockMap[Union,#,3]&

Try it online!

Haskell, 90 bytes
g[]=[]
g(a:b:c:x)=(sum$map fromEnum[a==b,a==c,b==c]):g x
f x=[sum[1|y<-g x,y==n]|n<-[3,1]]

Try it online!
Looks a bit awkward...

Elixir, 92 bytes
fn a->import Enum;c=map chunk(a,3),&(length uniq&1);{count(c,&(&1==1)),count(c,&(&1==2))}end

First, chunks the list into size length 3 chunk(a,3)
Secondly, it converts finds the length of each element, uniqified; map chunk(a,3),&(length uniq&1).
Finally, it returns an array consisting of the number of times the resulting list is equal to one count(c,&(&1==1)) and the number of times the resulting list is equal to two count(c,&(&1==2)).
Try it online!

Ruby, 59 bytes
->a{[1,2].map{|x|a.each_slice(3).count{|y|x==y.uniq.size}}}

Try it online!

Japt, 24 19 bytes
ò3 ®â l
[Uè¥1 Uè¥2]

Try it online!

Stax, 14 bytes
ü┬─*HTÜ╫\Ä╢qm♥

Run and debug it

[3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3] outputs [2,3] instead [1,3]

[3,3,3,4,4,4,5,5,5,6,6,6,5,4,3] outputs [1,0] instead [4,0]

[3,4,5,6,7,8,9,8,7,6,5,4,3,2,1] outputs [5,0] instead [0,0]

@LuisfelipeDejesusMunoz fixed

It doesn't currently show any output for [1,1,1].  If you use 2( instead of 1T it will always trim/pad to exactly size 2.

@recursive fixed

Prolog (SWI), 80 bytes
[A,B,C|T]-X/Y:-T-M/N,(A=B,B=C,X is M+1,Y=N;X=M,(A\=B,B\=C,Y=N;Y is N+1)).
_-0/0.

Try it online!

Factor + pair-rocket, 58 bytes
[ 3 group 1 => 2 [ '[ cardinality _ = ] count ] with map ]

Try it online!

Desmos, 84 bytes
l(r)=r.length
b=[l(k[3x-2...3x].unique)forx=[1...l(k)/3]]
f(k)=[l(b[b=1]),l(b[b=2])]

Try it on Desmos!

Elm, 108 106 bytes
import List.Extra as E
m=List.map
f x=m(\j->E.count((==)j)<|m(List.length<<E.unique)<|E.groupsOf 3 x)[1,2]

Try it on Ellie

C (GCC), 135 128 117 bytes
-7 bytes thanks to @ceilingcat
-11 more, again thanks to @ceilingcat
This is basically @ceilingcat's answer now, since he's improved it by more than 13 percent.
#define E(k)v[k-~i]==v[i
a;b;i;f(v,l)int*v;{for(a=b=i=0;i<l;i+=3)E()]&E(1)]?++a:E()]|E(1)]|E(1)+1]&&++b;*v=a;v[1]=b;}

Try It Online!
Unfortunately, I'm too lazy to write a new explanation for the most recent answer, but it's quite similar to the previous 128-byte one:
#define E(j,k)v[j+i]==v[k-~i]
a;b;i;f(v,l)int*v;{for(a=b=i=0;i<l;i+=3)E(,)&&E(,1)&&++a||(E(,)||E(,1)||E(1,1))&&++b;*v=a;v[1]=b;}

Try It Online!
f takes a vector (v) and its length (l) as arguments, and return its values in the first two elements of that vector. Explanation:
#define E(j,k)v[j+i]==v[k-~i] // k-~i == k-(-i-1) == k+i+1. an empty first argument equals +i, and an empty second argument equals -~i == i+1
a;b;i;
f(v,l)int*v;
{
    for(a=b=i=0;i<l;i+=3)
        E(,)&&E(,1)&&++a // if element i, i+1 and i+2 are all equal, increment a
        ||(E(,)||E(,1)||E(1,1))&&++b; // otherwise, if any two elements are equal, increment b
    *v=a; // set the first element in v to a
    v[1]=b; // set the second one to b
}

Zsh +coreutils, 67 bytes
for i j k;sort<<<"$i
$j
$k"|uniq -c>>a;h()grep -c "^ *$1" a;h 3;h 2

Try it online!
72b
78b
83b
102b
116b
128b
for... passes the args in groups of 3, uniq finds the doubles and triples, grep counts the results.
Zsh builtins only, 67 bytes
repeat $#/3 a+=(${#@[1,3]:#$1})&&shift 3;h()<<<${(M)#a:#$1};h 0;h 1

Try it online!

Nibbles, 9 bytes
.,2,`?.`/3@,`$$@

Attempt This Online!
Explanation
.    Map
,2    [1,2]
,     length of
`?     find indices in
.       map
`/ 3     split into chunks of 3
@         input
,        length of
`$        deduplicate
$          the chunk
@       of the number (1 or 2)

Arturo, 61 57 56 bytes
$->a[b:[x,y,z]map[1,2]'n->enumerate a b->n=size tally@b]

Try it

Husk, 9 bytes
hmLkoLuC3

Try it online!

Vyxal 14 13 bytes
3ẇƛ∪L;:1O$2Ox

Try it online!
Explanation:
3ẇ             # 3-partition
  ƛ            # Open lambda map
   ∪L          # Length of sublist union
     ;         # Close lambda map
      :        # Duplicate for next operation
       1O      # Count 1
         $     # Swap
          2O   # Count 2
            x  # Print stack as list

Raku, 30 bytes
(+«*.rotor(3)».Set).Bag{1,2}

Try it online!

*.rotor(3) breaks up the input list into groups of three elements.
».Set converts each of those groups into a Set.
+« converts each of those sets into its size.
.Bag makes a Bag (a set with multiplicity) out of those sizes.
{1, 2} looks up in that Bag the number of times sets with sizes of 1 and 2 were present.

Wolfram Language (Mathematica), 44 bytes
0&@@@c@BlockMap[Max@*c,#,3]/@{3,2}&
c=Counts

Try it online!
            BlockMap[Max@*Counts,#,3]           #equal in each block of 3
     Counts@                         /@{3,2}    count 3 equal, 2 equal
0&@@@                                           coerce Missing[...] to 0

Thunno 2, 10 bytes
3ẇıUl;12dc

Try it online!
Explanation
3ẇıUl;12dc  # Implicit input
3ẇ          # Split into threes
  ı  ;      # Map over the list:
   Ul       #  Length of uniquified list
      12dc  # Count 1s and 2s
            # Implicit output

Tcl, 111 bytes
proc S {L a\ 0 e\ 0} {lmap {x y z} $L {expr {$x-$y|$y-$z?$x==$y|$y==$z|$x==$z?[incr e]:0:[incr a]}}
list $a $e}

Try it online!

Tcl, 112 bytes
proc S {L a\ 0 e\ 0} {lmap {x y z} $L {expr {$x-$y||$y-$z?$x==$y|$y==$z|$x==$z?[incr e]:0:[incr a]}}
list $a $e}

Try it online!

Tcl, 114 bytes
proc S {L a\ 0 e\ 0} {lmap {x y z} $L {expr {$x==$y&&$y==$z?[incr a]:$x==$y|$y==$z|$x==$z?[incr e]:0}}
list $a $e}

Try it online!

C# (Visual C# Interactive Compiler), 108 bytes
x=>new[]{1,2}.Select(n=>x.Select((v,i)=>(v,g:i/3)).GroupBy(y=>y.g,y=>y.v).Count(y=>y.Distinct().Count()==n))

Try it online!
Less golfed...
// x is the input list of ints
x=>x
  // 1 distinct number means 3/3 are the same
  // 2 distinct number means 2/3 are the same
  new[]{1,2}
  // iterate over the outer array to get an index
  .Select(n=>x
    // iterate over the whole list with an index
    // and break into groups of size 3
    .Select((v,i)=>v,g:i/3))
    .GroupBy(y=>y.g,y=>y.v)
     // count the distinct values in each group
     // and get the result based on outer array value
    .Count(y=>y.Distinct().Count()==n))

Tcl, 98 bytes
proc A l {set 1 0;set 2 0
foreach a\ b\ c $l {incr [llength [lsort -u "$a $b $c"]]}
return $1\ $2}

Try it online!
using -unique option of lsort command. I named 1 and 2 my variables for convenience, tough it seems pretty unusual to code set 1 0 :)

Pip -p, 14 bytes
_N#*UQ*g<>3M12

Takes the numbers as command-line arguments. Attempt This Online!
Explanation
_N#*UQ*g<>3M12
       g        ; List of command-line args
        <>3     ; Group into 3-element sublists
    UQ*         ; Uniquify each
  #*            ; Get length of each
_N              ; Lambda expression: how many times does the argument appear in ^
           M12  ; Map that lambda to the arguments 1 and 2

This returns a list containing the number of length-1 uniquified sublists and the number of length-2 uniquified sublists.

Julia, 89 bytes
!x=(~=sum;a=length(x);b=[x[i:i+2] for i=1:3:a];c=~allequal.(b);[c,a÷3-c-~allunique.(b)])

Attempt This Online!
Julia has allequal and allunique built in. To find the number of triplets containing exactly 2 matching values (all remaining cases), I subtract these two amounts from the total. Replacing ÷ with / saves one byte, but the value becomes a float.

Nim, 105 bytes
import sequtils
proc e[S](s:S):S=[1,2].mapIt s.distribute(s.len div 3).mapIt(it.deduplicate.len).count it

Attempt This Online!

JavaScript, 82 bytes
Without recursion
a=>(b=[,0,0],a.map(d=>([x,y,z,...a]=a,x&&++b[new Set([x,y,z]).size])),[b[1],b[2]])

Try it:

f=a=>(b=[,0,0],a.map(d=>([x,y,z,...a]=a,x&&++b[new Set([x,y,z]).size])),[b[1],b[2]])

console.log(f([3,5,6,5,5,7,6,6,8,7,7,7,3,4,2,4,4,3])); // [1, 3]
console.log(f([3,3,3,4,4,4,5,5,5,6,6,6,5,4,3])); // [4, 0]
console.log(f([3,4,5,6,7,8,9,8,7,6,5,4,3,2,1])); // [0, 0]

Thunno, \$ 12 \log_{256}(96) \approx \$ 9.88 bytes
3ApeZULE12dc

Attempt This Online!
Port of Emigna's 05AB1E answer.
Explanation
3ApeZULE12dc  # Implicit input
3Ap           # Split into sublists of length 3
   e   E      # For each sublist:
    ZU        #   Remove duplicates
      L       #   And get the length
        12dc  # Count the number of 1s and 2s in this list
              # Implicit output

PowerShell, 81 bytes
for($r=@{};$i-$args.Count;$i++){$r[($args[$i++..++$i]|sort|gu).Count]++}
$r[1..2]

Try it online!
Explanations
Look at the array by taking sub arrays of three successive elements $args[$i..($i+2)]
We count the number of items in the sub array after sorting and removing duplicates (gu)
Then we increment the count in the result object $r
From $r, we then show only the entries with a single or two numbers

Scala, 185 bytes
Golfed version. Try it online!
val f:Array[Int]=>Array[Int]=l=> {var r=Array(0,0,0);var i=0;var a,b,c=0;while(i<l.length){b=l(i);c=l(i+1);a=l(i+2);r(if(a==b){if(b==c)0 else 1} else if(b==c||a==c)1 else 2)+=1;i+=3};r}

Ungolfed version. Try it online!
import java.util.Arrays
import java.util.function.Function

object Main {
  def main(args: Array[String]): Unit = {
    val f: Array[Int] => Array[Int] = l => {
      var r = Array(0, 0, 0)
      var i = 0
      var a, b, c = 0
      while (i < l.length) {
        b = l(i)
        c = l(i + 1)
        a = l(i + 2)
        r(if (a == b) {
          if (b == c) 0 else 1
        } else if (b == c || a == c) 1 else 2) += 1
        i += 3
      }
      r
    }
    val tests = Array(
      Array(2, 4, 2, 5, 5, 5, 4, 2, 1, 3, 3, 1),
      Array(3, 5, 6, 5, 5, 7, 6, 6, 8, 7, 7, 7, 3, 4, 2, 4, 4, 3),
      Array(3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 5, 4, 3),
      Array(3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1)
    )
    for (test <- tests) {
      val result = f.apply(test)
      printf("%s: %s%n", Arrays.toString(test), Arrays.toString(result))
    }
  }
}

Vyxal s, 57 bitsv1, 7.125 bytes
3ẇƛUL12f=

Try it Online!
Explained
3ẇƛUL12f=
3ẇ         # Wrap into chunks of 3
  ƛ        # to each chunk
   UL      #   take the length of the chunk uniquified
     12f=  #   and push whether 1 and 2 is in that length list
# the s flag reduces the list by addition, which is performed element-wise vectorised

Created with the help of Luminespire.