text:
The Top Ten Elements You Won't BELIEVE Are In This Array
AKA: Generate Clickbait From an Array.
Given an array of integers, generate some cringe-worthy clickbait based on its arrangement and length:

If it's 20 elements or less, you can make a Top X List. Parameters: length of the array.
Prime numbers are celebrities, so anytime two of them are next to each other it'll pass as gossip. Parameters: the two adjacent primes in the order they appear in the array.
If any number appears twice or more in the array, then it's shocking and unbelievable and everyone needs to hear about it. If multiple numbers appear twice, make a news story for each one. Only print this once per unique number. Parameters: occurrence of the number measured by total appearance.
If you see 3+ elements in sorted monotonically increasing order, followed by a sudden decrease, then tell of how they're sorted and tease about what happens next. Only do this once per straight. Parameters: length of the straight.

These are the respective clickbaits you should use:
The Top {{N}} Array Elements
{{N1}} And {{N2}} Were Spotted Together, You Won't Believe What They Did
These {{N}} Elements Will Blow Your Mind
{{N}} Elements Sort Themselves, Find Out What Comes Next

Remember, you represent a cheap media company, so you'll need to milk this and print every possible title. If there are 2 identical titles, print them both.
For example, if you're given this array…
1,2,3,4,2,1,1,5,6

You should output all of these, in arbitrary order:
The Top 9 Array Elements
2 And 3 Were Spotted Together, You Won't Believe What They Did
These 2 Elements Will Blow Your Mind
These 3 Elements Will Blow Your Mind
4 Elements Sort Themselves, Find Out What Comes Next

Note the lack of this title:
3 Elements Sort Themselves, Find Out What Comes Next

As code golf, the shortest answer in bytes wins.

"3+ consecutive increasing elements, followed by a sudden decrease" What's the expected result for [ 2 3 4 4 ]?

@Arnauld there's no sudden decrease there, so just print the first 3 titles.

Shouldn't "These 2 Elements Will Blow Your Mind" appear twice (once for 1 and once for 2)?

Usually I don't downvote, but -1 for solely creating a challenge just to use a click-bait title and a completely unnecessary output format for a challenge of type "do A, B and C, oh and also D". You should really read Things to avoid when writing challenges.

@JonathanAllan 2 appears twice so "These 2 Elements...", 1 appears three times so "These 3 Elements...". If 1 only appeared twice then you would be correct.

@BMO Maybe you should read the sandbox more often. This was on there for a considerable duration, when you might have voiced your opinions. Also, many challenges on this site use clickbait, it's not like this is the only challenge to do so lol

@KamilDrakari1 may appear three times, but it still appears twice!

@JonathanAllan "if there are 2 identical titles, print them both."

What exactly qualifies as a sudden decrease? Can it just be a decrease of 1 or does it have to be something larger?

2,3,2 will output in twice the prime gossip, or 2,3,1,2,3 (two primes two times)

There are enough edge cases that I suggest you write a reference implementation that demonstrates the exact logic answers should follow.

@DanielIndie I asked this and it was clarified by adding "the two adjacent primes in the order they appear in the array" and "print every possible title" (so yes, 2,3,2 and 2,3,1,2,3 will both output two prime gossip clickbaits).

@ConorO'Brien: Probably I should, if I saw it there I'd voiced my opinion there. But I thought I'd give a reason for my downvote because silently downvoting is of no use to anyone. About the click-bait, I think there's a massive difference between a catchy title for a good challenge and a challenge that's only been made for using a click-bait title.

I'm assuming only positive integers > 0 are part of the input-array? Didn't see it in any rule nor comment yet.

For the example [1,2,3,4,2,1,1,5,6], shouldn't the gossip N Elements Sort Themselves, Find Out What Comes Next be outputted twice, once with N=4 for [1,2,3,4] and once with N=3 for [1,5,6]? If not for the second, the term/Wikipedia-link for 'monotonically increasing' is incorrect. If it's indeed incorrect, should only increasing sequences by 1, like [1,2,3] or [5,6,7] be correct, or also by any k other than 1, like [1,3,5] or [6,9,12]?

@KevinCruijssen it doesn't just need to be monotonically increasing, it also needs an element after it that breaks the pattern.

@StephenLeppik Ah of course, I read past that part. Thanks. I'll fix my answer. Should actually save bytes. ;)

Jelly, 142 bytes
I>-ṣ0ṖS€ỊÐḟ‘ɓĠL€ḟ1,ɓ¹ƝÆPẠ$ÐfW;ɓLẋ<¥21W;ż@€"“æƥu®ụ³Km&|°ẓz“ṿ$¥{d3ɓFȤSJẎVḍnṃ*¹0Ḟ¬ȤɲƝċƲạB'ɼɓ.€⁺Ƒ“¢ßUṡʠx\~⁻ḅėʠAƓḳ¶e<“½ė!Ƙ¥Ḍ3]⁷ṀƭȮþċ⁽?ṫĠƁÆȦØ⁾Ż»ṣ€⁷¤

A monadic link accepting a list of integers, returning a list of lists of clickbaits (each of which is a list of characters and integers). For a full program printing line-feed separated clickbaits just add ẎY to the end.
Try it online! (Footer makes a single list of clickbaits and then separates them with new-lines.)
...or see the example given in the question.
How?
The 99 right-most bytes of this Link form a nilad (a function with zero arguments, i.e. a constant):
“...“...“...“...»ṣ€⁷¤
                    ¤ - nilad followed by link(s) as a nilad:
“...“...“...“...»     - list of compressed strings (the four clickbait-texts with the
                      -   integers replaced with line-feed characters)
                   ⁷  - literal line-feed character
                 ṣ€   - split-at for €ach (read to interweave with the integers)

Let's label these text-parts as X, now the Link is:
I>-ṣ0ṖS€ỊÐḟ‘ɓĠL€ḟ1,ɓ¹ƝÆPẠ$ÐfW;ɓLẋ<¥21W;ż@€"X - Link: list of integers Z
                                             - # get the monotonically increasing runs:
I                                            - incremental differences of Z
 >-                                          - greater than -1 (vectorises)
   ṣ0                                        - split at zeros
     Ṗ                                       - pop (discard final run)
      S€                                     - sum each (length - 1 for all runs)
         Ðḟ                                  - filter discard if:
        Ị                                    -   insignificant (discard any 0s or 1s)
           ‘                                 - increment (yielding all run-lengths >= 3)
            ɓ                                - new dyadic chain with that on the right
                                             - # get the multiplicities:
             Ġ                               - group indices of Z by value
              L€                             - length of €ach
                ḟ1                           - filter discard 1s
                  ,                          - pair with right (the run-lengths)
                   ɓ                         - new dyadic chain with that on the right
                                             - # get the prime-pairs
                     Ɲ                       - for each pair in Z
                    ¹                        -   identity (do nothing)
                          Ðf                 - filter keep if:
                         $                   -   last two links as a monad:
                      ÆP                     -     is prime? (vectorises)
                        Ạ                    -     all?
                            W                - wrap in a list
                             ;               - concatenate with right ([multiplicities,runs])
                              ɓ              - new dyadic chain with that on the right
                                             - # get top count as a list
                               L             - length
                                   21        - literal 21
                                  ¥          - last two links as a dyad
                                 <           -   less than? (1 if 20 or less, else 0)
                                ẋ            -   repeat ([length] if 20 or less, else [])
                                     W       - wrap in a list (i.e. [[length]] or [[]])
                                      ;      - concatenate with right ([[prime pairs],[multiplicities],[run-lengths]])
                                             - ...now we have [[length],[prime pairs],[multiplicities],[run-lengths]]
                                          "X - zip with X (the text-parts)
                                         €   -   for each (item in the current list):
                                       ż@    -     interleave with swapped arguments

Impressive! :P Didn't even use the sentences...wow

That is because Jelly has the ability to have compressed strings. The sentences are there in the “...“...“...“...» part of the code, with line feeds in place of the numbers -- like this

That's a whole lotta Jelly...

Longest jelly golf I've seen. My answer here comes close but still shorter by 16 bytes

@dylnan I have a few Jelly golfs which are longer, a couple of which I think are more impressive

Wow, those are quite long

I think we should add the prize for longest Jelly program to Best of PPCG 2018.

Java 10, 467 457 456 453 bytes
a->{int l=a.length,i=0,p=0,P=0,m[]=new int[999],t;String e=" Elements ",r=l<21?"The Top "+l+" Array"+e+"\n":"";for(;i<l;r+=i>0&&p(p)>1&p(t=a[i-1])>1?p+" And "+t+" Were Spotted Together, You Won't Believe What They Did\n":"",m[a[i++]]++)if(p<(p=a[i]))P++;else{r+=P>2?P+e+"Sort Themselves, Find Out What Comes Next\n":"";P=1;}for(;l-->0;r+=m[l]>1?"These "+m[l]+e+"Will Blow Your Mind\n":"");return r;}int p(int n){for(int i=2;i<n;n=n%i++<1?0:n);return n;}

Assumes the input-array will contain values 0 < N < 1000 ([1,999]).
Try it online.
a->{                     // Method with integer-array parameter and String return-type
  int l=a.length,        //  Length of the input-array
      i=0,               //  Index-integer
      p=0,               //  Previous item, starting at 0
      P=0,               //  Sequence-counter, starting at 0
      m[]=new int[999],  //  Element-counter array, starting filled with 0s
      t;                 //  Temp-integer to reduce the byte-count
  String e=" Elements ", //  Temp-String " Elements " to reduce byte-count
         r=l<21?         //  If the size of the input-array is 20 or less:
            "The Top "+l+" Array"+e+"\n"
                         //    Start the result-String with 'length' gossip-line
           :             //   Else:
            "";          //    Start the result-String empty
  for(;i<l               //  Loop over the input-array
      ;                  //    After every iteration:
       r+=i>0&&          //     If this is not the first item,
           p(p)>1&p(t=a[i-1])>1?
                         //     and the current and previous items are both primes:
             p+" And "+t+" Were Spotted Together, You Won't Believe What They Did\n":"",
                         //      Append the 'two primes' gossip-line
       m[a[i++]]++)      //     Increase the counter of the current value by 1
    if(p<(p=a[i])        //   If the previous item is smaller than the current:
      P++;               //    Increase the sequence-counter by 1
    else{                //   Else:
      r+=P>2             //    If the sequence-counter is 3 or larger:
          P+e+"Sort Themselves, Find Out What Comes Next\n":"";
                         //     Append the 'sequence' gossip-line
      P=1;}              //    Reset the sequence-counter to 1
  for(;l-->0;            //  Loop over the Element-counter array
      r+=m[l]>1?         //   If this element occurred at least two times:
          "These "+m[l]+e+"Will Blow Your Mind\n":"");
                         //    Append the 'occurrence' gossip-line
  return r;}             //  Return the result

// Separated method to check if the given number is a prime
// If `n` is a prime, it remains the same; if not: either 1 or 0 is returned
int p(int n){for(int i=2;i<n;n=n%i++<1?0:n);return n;}

still golfing but help will be much appreciated

JavaScript (Node.js), 397 bytes
a=>a.map(x=>(l<=x?s++:(s>2&&r.push(s+" Elements Sort Themselves, Find Out What Comes Next"),s=1),P(x)&&P(l)&&r.push(l+` And ${x} Were Spotted Together, You Won't Believe What They Did`),c[l=x]=-~c[x]),c=[s=l=r=[]])&&c.map((x,i)=>x>1&&c.indexOf(x)==i&&r.push(`These ${x} Elements Will Blow Your Mind`))&&[...r,...a[20]?[]:[`The Top ${a.length} Array Elements`]]
P=(n,i=1)=>n>1&&++i*i>n||n%i&&P(n,i)

Try it online!

Could you save by replacing a single character like '!' with ' Elements ' (or similar)?

You've failed to correctly handle a right-hand monotonically increasing run with no trailing decrease (the link you give should not output "6 Elements Sort Themselves, Find Out What Comes Next", as there is no "Next")

Lack The Top * Array Elements

well this even shorter y code in my origin answer i did it this way. will be fixed. @l4m2 thanks

I'm not 100% sure, because the sentence in the challenge description can be interpret two ways, but shouldn't [5,10,5,10] output the These 2 Elements Will Blow Your Mind twice? I think the challenge part "Only print this once per unique number." means the numbers 5 and 10, not the number N=2. But perhaps ask OP to verify. If the second, your implementation is correct and the other three answers are incorrect. If the first only your implementation is incorrect.

@KevinCruijssen not from the way i understood it

JavaScript (Node.js), 351 350 349 347 bytes
a=>a.map((x,i)=>c[s=x>=l?-~s:++s>2&&(t+=s+` Elements Sort Themselves, Find Out What Comes Next
`),P(x)&P(l)&&(t+=l+` And ${x} Were Spotted Together, You Won't Believe What They Did
`),l=x]=-~c[x],t=a[20]?'':`The Top ${a.length} Array Elements
`,c=[s=l=P=(n,i=n)=>n%--i?P(n,i):1/i])+c.map(x=>x>1&&(t+=`These ${x} Elements Will Blow Your Mind
`))&&t

Try it online!


text:
Decode the string
This is my first challenge on ppcg!
Input
A string consisting of two different ascii characters. For example
ABAABBAAAAAABBAAABAABBAABA

Challenge
The task is to decode this string following these rules:

Skip the first two characters
Split the rest of the string into groups of 8 characters
In each group, replace each character with 0 if that character is the same as the first character of the original string, and with 1 otherwise
Now each group represents a byte. Convert each group to character from byte char code
Concatenate all characters

Example
Let's decode the above string.
 AB  AABBAAAA  AABBAAAB  AABBAABA
 ^^     ^         ^         ^
 |      |         |         |
 |      \---------|---------/
 |                |
Skip      Convert to binary

Notice that A is the first character in the original string and B is the second. Therefore, replace each A with 0 and each B with 1. Now we obtain:
00110000  00110001  00110010

which is [0x30, 0x31, 0x32] in binary. These values represent characters ["0", "1", "2"] respectively, so the final output should be 012.
Scoring
This is, of course, code-golf, which means make your code as short as possible. Score is measured in bytes.
Constraints and IO format
Standard rules apply. Here are some additional rules:

You can assume valid input

Input string consists of exactly two different characters
The first two characters are different
The minimal length of the input string is 2 characters
The length will always give 2 modulo 8

You can assume the string will always consist only of printable ASCII characters

Both in the input and in the decoded string

Leading and trailing whitespace are allowed in the output (everything that matches /\s*/)

Gotta say man, for a first challenge, this is one of the better formatted challenges I've ever seen. As an fyi, the community sandbox is a great place for feedback before posting so you don't get randomly rep bombed for a rule you didn't know.

@MagicOctopusUrn. Thank you! Didn't know about sandbox, I'll post there next time :)

I mostly use it so people can call me out on duplicate questions, very simple to follow rules, rather hard to know about dupes without memorizing meta :). I'd also recommend checking out the chatrooms, we have chats for almost every language you could hope to learn and questions are encouraged.

Great first challenge! Some more test cases would be neat.

Really nice first challenge. Had fun playing with this one.

brainfuck, 76 71 65 bytes
-6 bytes thanks to Nitrodon!
,>>,,[>>++++++++[-[->+<]<<<<[->+>-<<]>>[[-]>>+<<]>[->++<],>>]<.<]

Try it online!
Feels weird beating Python...

Not if the 8 keywords in BF were as long as their Python counterpart.

It helps that BF automatically converts the unicode.

65 bytes

Stax, 15 11 bytes
ó║¥U⌂½íèäöñ

Run and debug it at staxlang.xyz!
Quick 'n' dirty approach. Working on improving it. Improved it!
Unpacked (13 bytes) and explanation
2:/8/{{[Im:bm
2:/              Split at index 2. Push head, then tail.
   8/            Split into length-8 segments.
     {      m    Map block over each segment:
      {  m         Map block over each character:
       [             Copy first two elements (below) in-place.
        I            Index of character in first two characters.
          :b       Convert from binary.
                 Implicit print as string.

Ahhhh... I knew this would beat us.

05AB1E, 10 bytes
¦¦Sk8ôJCçJ

Try it online!
-3 thanks to emigna.

Ù             # Unique letters, in order they appear.
 v            # For each...
  yN:         # Push letter and index, replace in input.
     }        # End loop.
      ¦¦      # Remove first x2.
        8ô    # Split into eighths.
          C   # Convert to integer.
           ç  # Convert to char.
            J # Join together entire result.

You can use 01‡ instead of the loop. EDIT: or even better: ¦¦Sk8ôJCçJ

Ahhhh... I knew this would beat us.

bash, 59 58 52 bytes
tr -t "$1" 01 <<<$1|cut -c3-|fold -8|sed 'i2i
aP'|dc

Try it online!
Thanks to Cows quack for saving 6 bytes.
This challenge works remarkably well with a series of coreutils (and dc to do the conversion and output at the end). First, we use
tr -t "$1" 01 <<<$1

to transliterate the two characters in the input to zeroes and ones. The -t flag truncates the first argument to the length of the second, so this reduces to transliterating the first two characters in the input to 0 and 1, which is what we want. Then,
cut -c3-

removes the first two characters, and
fold -8

outputs 8 of the characters per line. Finally, the sed command turns each line into a dc snippet that reads the number as binary and outputs that byte.

Always nice to see a bash answer :) You can use sed to simplify the dc calculations by converting each line to dc code that prints each character out and then eval'ing it in dc https://tio.run/##S0oszvj/v6RIQbdEQUnFUEnBwFDBxsZGxbAmubREQTfZWLcmLT8nRUHXoqY4NUVBPdMokysxQL0mJfn///8KFQoKFUAMAmAayq9QAAA (and the space after cut -c can be removed)

JavaScript (Node.js), 67 bytes
s=>s.replace(/./g,x=(c,i)=>(x=x*2|c==s[1],Buffer(i<3|i&7^1?0:[x])))

Try it online!
How?
We use two different syntaxes of the Buffer constructor:

Buffer([n]) generates a buffer containing the sole byte n and is coerced to the corresponding ASCII character. Only the 8 least significant bits of n are considered.
Buffer(n) generates a buffer of n bytes. Therefore, Buffer(0) generates an empty buffer, which is coerced to an empty string.

Note: They both are deprecated in recent Node versions. Buffer.from([n]) and Buffer.alloc(n) should be used instead.
Commented
s =>                   // given the input string s
  s.replace(/./g, x =  // initialize x to a non-numeric value (will be coerced to 0)
    (c, i) => (        // for each character c at position i in s:
      x = x * 2 |      //   shift x to the left
          c == s[1],   //   and append the new bit, based on the comparison of c with s[1]
      Buffer(          //   invoke the constructor of Buffer (see above):
        i < 3 |        //     if i is less than 3
        i & 7 ^ 1 ?    //     or i is not congruent to 1 modulo 8:
          0            //       replace c with an empty string
        :              //     else:
          [x]          //       replace c with the ASCII char. whose code is the LSB of x
      )                //   end of Buffer constructor
  ))                   // end of replace(); return the new string

Z80 machine code on an Amstrad CPC, 32 31 30 bytes
000001  0000  (9000)        ORG &9000
000002  9000  EB            EX DE, HL
000003  9001  46            LD B, (HL)
000004  9002  23            INC HL
000005  9003  5E            LD E, (HL)
000006  9004  23            INC HL
000007  9005  56            LD D, (HL)
000009  9006  1A            LD A, (DE)
000010  9007  05            DEC B
000011  9008  13            INC DE
000012  9009  4F            LD C, A
000014  900A                Light
000015  900A  26 01         LD H, &01
000016  900C                Last
000017  900C  13            INC DE
000018  900D  05            DEC B
000019  900E  C8            RET Z
000021  900F                Loop
000022  900F  1A            LD A, (DE)
000023  9010  B9            CP C
000024  9011  28 01         JR Z, Lable
000025  9013  37            SCF
000026  9014                Lable
000027  9014  ED 6A         ADC HL, HL
000028  9016  30 F4         JR NC, Last
000029  9018  7D            LD A, L
000030  9019  CD 5A BB      CALL &BB5A
000032  901C  18 EC         JR Light

The code takes the instruction replace each character with 0 if that character is the same as the first character of the original string, and with 1 otherwise literally and doesn't ever bother to check that a character matches the second character in the input string. It just checks for same-as-first-character and different-from-first-character.
I ran out of registers (the Z80 only has 7 easily usable 8-bit registers, the rest need longer instructions) so I put &01 in H, along with using L to build up the ASCII character (I just realised it's unnecessary to initialise L, saving one byte). When H overflows into the Carry flag, the character in L is ready to be output. Luckily, there is a 16-bit ADC (Add with Carry) that does the job of a left-shift instruction.
(DE) can only be read into A although (HL) can be read into any 8-bit register, so it was a compromise which one to use. I couldn't compare (DE) with C directly, so I had to load one into A first. The labels are just random words that start with L (a requirement of the assembler).

A the Accumulator - the only register that can do comparisons
B the counter register for the instruction DJNZ: Decrement (B) and Jump if Non Zero. By rearranging the code, I was able to do the job of DJNZ with one fewer byte
C the first character in the input string
D, E as DE the address of the current input character
H the carry trigger (every 8th loop)
L the output character being built up

J, 17 13 Bytes
u:_8#.\2}.1{=

-4 thanks to FrownyFrog
Old version:
u:_8#.\2&({.i.}.)

Explanation:
u:_8#.\2}.1{=
            =  | Self classify, for each unique element x of y, compute x = y, element-wise
          1{   | Second row
       2}.     | Drop 2
  _8#.\        | Convert non-intersecting subarrays of length 8 from binary
u:             | Convert to characters

Examples:
   = 'ABAABBAAAAAABBAAABAABBAABA'
1 0 1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 0 1
0 1 0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 1 0

   2}.1{= 'ABAABBAAAAAABBAAABAABBAABA'
0 0 1 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 1 0

   _8#.\2}.1{= 'ABAABBAAAAAABBAAABAABBAABA'
48 49 50

   u:_8#.\2}.1{= 'ABAABBAAAAAABBAAABAABBAABA'
012

2}.1{= to save 4 bytes.

Oh my, tied... I can't find another byte.

@MagicOctopusUrn it's actually a snippet, it should have a [: at the start :)

R, 71 bytes
function(s)intToUtf8(2^(7:0)%*%matrix((y=utf8ToInt(s))[-1:-2]==y[2],8))

Try it online!
Surprisingly golfy!
First, converts the string to ascii code-points with utf8ToInt, saving it as y. Removing the first two characters with negative indexing is shorter than using tail.
The array y[-1:-2]==y[2] is equivalent to the bits when %*% (matrix multiplication) is applied, but first we reshape that array into a matrix with nrow=8, converting from a linear array to byte groupings. Fortuitously, we can then convert to the ascii code points using matrix multiplication with the appropriate powers of 2, 2^(7:0), and then we convert the code points back to a string with intToUtf8.

Python 2, 77 bytes
lambda s:[chr(int(`map(s.find,s)`[i:i+24:3],2))for i in range(7,3*len(s),24)]

Try it online!

Pyth, 20 9 bytes
CittxLQQ2

Saved 11 bytes thanks to FryAmTheEggman.
Try it here
Explanation
CittxLQQ2
    xLQQ    Find the index of each character in the string.
  tt        Exclude the first 2.
 i      2   Convert from binary.
C           Get the characters.

@FryAmTheEggman Thanks.  Evidently I've still got a lot to learn about Pyth.

Haha, so do I! It's a very intricate golfing language. I hope you continue golfing in it :)

Python 3, 77 bytes
a,b,*r=input();x=i=0
for c in r:i*=2;i|=a!=c;x+=1;x%8or print(end=chr(i&255))

Try it online!

PHP, 73 71 bytes
while($s=substr($argn,-6+$i+=8,8))echo~chr(bindec(strtr($s,$argn,10)));

Run as pipe with -nR or try it online.
golfings:

start index at -6 and pre-increment by 8
exploit that strtr ignores excessive chars in the longer parameter (no substr needed)
translating to 10 and then inverting needs no quotes -> -1 byte
invert character instead of ascii code --> ~ serves as word boundary -> -1 byte.

At least you should match brainfuck: for(;$s=substr($argn,2+8*$i++,8);)echo~chr(bindec(strtr($s,$argn,10)));

@Christoph I like how Brainfuck is suddenly a standard for reasonable answer length.

Japt, 11 bytes
¤£bXÃò8 ®Íd

Try it

Explanation
¤               :Slice from the 3rd character
 £  Ã           :Map over each X
  bX            :  Get the first 0-based index of X in the input
     ò8         :Split to an array of strings of length 8
        ®       :Map
         Í      :  Convert from base-2 string to base-10 integer
          d     :  Get the character at that codepoint

Very clever use of the s2 shortcut, nice.

Java 8, 143 142 141 bytes
s->{char i=47;for(;++i<50;)s=s.replace(s.charAt(i%2),i);for(i=2;i<s.length();)System.out.print((char)Long.parseLong(s.substring(i,i+=8),2));}

-1 byte thanks to @OlivierGrégoire.
Try it online.
Explanation:
s->{                            // Method with String parameter and no return-type
  char i=47;                    //  Index character, starting at 47
  for(;++i<50;)                 //  Loop 2 times
    s.replace(s.charAt(i%2),i)  //   Replace first characters to 0, second characters to 1
  for(i=2;i<s.length();)        //  Loop `i` from 2 upwards over the String-length
    System.out.print(           //   Print:
     (char)                     //    As character:
      Long.parseLong(           //     Convert Binary-String to number
       s.substring(i,i+=8)      //      The substring in range [i,i+8),
      ,2));}

142 bytes

Ruby, 82 79 bytes
->s{s[2..-1].tr(s[0,2],'01').chars.each_slice(8).map{|s|s.join.to_i(2).chr}*''}

Try it online!

Welcome to PPCG! I didn't see that there was already an answer in Ruby before i posted mine, but some typical golfing tricks apply to your approach too - e.g., the last .join can be replaced by *'', and s[0..1] by s[0,2].

PHP + GNU Multiple Precision, 63 61
<?=gmp_export(gmp_init(substr(strtr($argn,$argn,"01"),2),2));

sadly the GMP extention is not default activated (but shipped).
Run like this:
echo "ABABABAAAAABABAAAAAABAABBAABAAAABBABAAABBB" | php -F a.php

<?= saves 2 bytes and possibly the day. ;-)

@Titus yeah but sadly it doesn't work with -R (I tried).

try -F instead

Haskell, 75 bytes
f[_,_]=""
f(z:o:s)=toEnum(sum[2^b|(b,c)<-zip[7,6..0]s,c==o]):f(z:o:drop 8s)

Try it online!

Perl 5 -lp, 34 bytes
#!/usr/bin/perl -lp
s%.%1-/^$&/%eg;$_=pack'B*',s/..//r

Try it online!

REXX, 41 bytes
arg a+2 b
say x2c(b2x(translate(b,01,a)))

Try it online!

Very cool. Not played with REXX for a long time.

Python 3, 99 86 bytes
lambda s:[chr(int(str(list(map(s.find,s[i:i+8])))[1::3],2))for i in range(2,len(s),8)]

Try it online!
Thanks to ASCII-only for basically the whole thing really

Nice, but it fails here.

86, port of python 2 method. returns as list though but at least it works

Red, 110 bytes
func[s][t: 0 i: 128 foreach c next next s[if c = s/2[t: t + i]i: i / 2 if i = 0[prin to-char t t: 0 i: 128]]]

Try it online!
Explanation:
A simple straightforward solution, no builtins.
f: func [s] [                      ; s is the argument (string)
    t: 0                           ; total - initially 0
    i: 128                         ; powers of 2, initially 0
    b: s/2                         ; b is the second charachter
    foreach c next next s [        ; for each char in the input string after the 2nd one
        if c = b [t: t + i]        ; if it's equal to b than add the power of 2 to t
        i: i / 2                   ; previous power of 2
        if i = 0 [                 ; if it's 0
            prin to-char t         ; convert t to character and print it
            t: 0                   ; set t to 0
            i: 128                 ; i to 128
        ]
    ]
]

APL+WIN, 30 bytes
Index origin 0. Prompts for input of string
⎕av[2⊥¨(+\0=8|⍳⍴b)⊂b←2↓s≠↑s←⎕]

Explanation:
s≠↑s←⎕ prompts for string and creates binary vector not equal to first character

b←2↓s drops first two elements of binary

(+\0=8|⍳⍴b)⊂ splits binary into groups of 8

2⊥¨ converts each group to decimal

⎕av[...] displays decoded characters

I assume Quad-AV is in-line with ASCII for APL+WIN?

@Zacharý Yes for the first 128 characters. The special APL characters replace some of the characters in the extended ASCII character set.

Ruby, 61 42 bytes
-19 bytes thanks to benj2240
->s{[s[2..-1].tr(s[0,2],"01")].pack("B*")}

Try it online!

pack is an inspired choice, but right now you're sort of going the long way around. It can do even more of the work for you.

Yep, that was a total mind-block from my side...

Google Sheets, 123 bytes
=ArrayFormula(Join("",IfError(Char(Bin2Dec(Substitute(Substitute(Mid(A1,3+8*(Row(A:A)-1),8),Left(A1),0),Mid(A1,2,1),1))),""

Input is in cell A1. Google will automatically add ))) to the end of the formula.
Explanation:

Mid(A1,3+8*(Row(A:A)-1),8) grabs chunks of characters 8 at a time, starting with the third.
Substitute(Mid(~),Left(A1),0) replaces each instance of the first character with 0.
Substitute(Substitute(~),Mid(A1,2,1),1) replaces the second character with 1.
Char(Bin2Dec(Substitute(~))) converts the chunk to decimal and then to ASCII.
IfError(Char(~,"")) corrects all the errors that result from the fact that Row(A:A) returns far more values than we so Bin2Dec gives us a lot of zero values and Char errors out on zero.
ArrayFormula(Join("",IfError(~))) joins together all the Char results and ArrayFormula is what makes the Row(A:A) return an array of values instead of just the first value.

Python 2, 88 bytes
i=input()
f=''.join('10'[x==i[0]]for x in i[2:])
while f:print chr(int(f[:8],2));f=f[8:]

Try it online!
Not the shortest - just an alternative way.
Following version prints the output on one line for 98 bytes although the rules state that trailing whitespace is allowed.:
i=input();f=''.join('10'[x==i[0]]for x in i[2:]);o=""
while f:o+=chr(int(f[:8],2));f=f[8:]
print o

Try it online!

Final output should be on one line, not three.

From OP: "Leading and trailing whitespace are allowed in the output (everything that matches /\s*/)". Newline matches /\s*/.

Sorry, I'm not well-enough versed in regex notation. :/

Neither am I but i Googled it just to be sure ;-)

Perl 5 -p, 40 bytes
s/(.)(.)//;$_=pack'B*',eval"y/$1$2/01/r"

Try it online!

Scala, 95 bytes
s.substring(2).replace(s(0),'0').replace(s(1),'1').grouped(8).map(Integer.parseInt(_,2).toChar)

Try it online!

K4, 22 21 bytes
Solution:
"c"$2/:'0N 8#?/0 2_x:

Example:
q)k)"c"$2/:'0N 8#?/0 2_x:"ABAABBAAAAAABBAAABAABBAABA"
"012"

Explanation:
Evaluated right-to-left:
"c"$2/:'0N 8#?/0 2_x: / the solution
                  x:  / save input as x
               0 2_   / cut x at 0 and 2nd index
             ?/       / lookup (?) over (/)
        0N 8#         / reshape into 8-long rows
    2/:'              / decode (/:) each (') from base 2
"c"$                  / cast to character

Notes:

-1 byte thanks to ngn!

x[1]=2_x: -> ?/0 2_

Haskell, 124 105 93 bytes
f(x:_:y)=fromEnum.(/=x)<$>y
g[]=[]
g s=(toEnum.sum.zipWith((*).(2^))[7,6..0])s:g(drop 8s)
g.f

Try it online!
f converts the string to a list of bits by comparing each character to the first one, turning the Bools into zeros and ones with fromEnum. g divides this list into groups of 8, converts them to decimal, and takes the value of the resulting number as an Enum, which Char is an instance of.
Changes:

-19 bytes thanks to @Laikoni (removing import, embedding map into function)
-12 bytes inspired by @Lynn's answer (getting rid of take by zipping with shorter list)

You can use toEnum instead of chr and drop the import. Also the map can be included into g. The space between 8 s can be removed.

C# (Visual C# Compiler), 158 bytes
using System.Linq;a=>new string(a.Skip(2).Where((c,i)=>(i-2)%8==0).Select((c,i)=>(char)a.Skip(8*i+2).Take(8).Select((d,j)=>d!=a[0]?1<<7-j:0).Sum()).ToArray())

Try it online!

C++, 181 Bytes (VS 2017)
#include<iostream>
int main(int,char**a){int c=7;uint8_t b=0;for(int i=2;a[1][i]!='\0';++i,--c){if(a[1][i]!=a[1][0]){b|=(1<<c);}if(c==0){std::cout<<static_cast<char>(b);c=8;b=0;}}}

Formatted, with better variable names and comments:
#include <iostream>

int main(int argc, char* argv[])
{
  int counter = 7;
  uint8_t byte = 0;

  // Loop until input string is fully read
  for (int i = 2; argv[1][i] != '\0'; ++i, --counter)
  {
    if (argv[1][i] != argv[1][0])
    {
      byte |= (1 << counter); // Shift 2^counter into the current byte
    }

    if (counter == 0)
    {
      std::cout << static_cast<char>(byte); //
      counter = 8;
      byte = 0;
    }
  }
}

Welcome to PPCG!

@Laikoni Thank you :), I will definitely try some more in the future!

Have fun! :) You might be interested in the collection of tips for golfing in C++.

Forth (gforth), 83 bytes
: f over c@ 0 rot 2 do 2* over i 4 pick + c@ <> - i 8 mod 1 = if emit 0 then loop ;

Try it online!
Input is a standard Forth string (address and length) output is printed to stdout
Explanation
over c@          \ get the value of the first character in the string
0 rot            \ add a starting "byte" value of 0 and put the length on top of the stack
2 do             \ start a loop from 2 to length-1
   2*            \ multiply the current byte value by 2 (shift "bits" left one)
   over          \ copy the reference char to the top of the stack
   i 4 pick +    \ add the index and the starting address to get address of the current char
   c@ <>         \ get the char at the address and check if not equal to the reference char
   -             \ subtract the value from our bit count, -1 is default "true" value in forth
   i 8 mod 1 =   \ check if we are at the last bit in a byte
   if            \ if we are
      emit 0     \ print the character and start our new byte at 0
   then          \ and end the if statement
loop             \ end the loop

C (tcc), 134 bytes
f(char*x){
    int a=*x,i,l=strlen(x);
    for(i=2;i<l;)
        x[i] = x[i++] - a ? 49 : 48;
    for(i=10;i<=l;i+=8)
        a=x[i],
        x[i]=0,
        putchar(strtol(x+i-8,0,2)),
        x[i]=a;
}

Try it online!
I am still trying to think of a better way than that ugly swap :P

Rust, 166 bytes
fn x(x:&str){for i in(2..x.len()-2).step_by(8){print!("{}",u8::from_str_radix(&x[i..i+8].chars().map(|c|(c as u8-17)as char).collect::<String>(),2).unwrap()as char)}}

Playground
Playground link because it requires nightly and tio seems to use stable.

Coconut, 71 bytes
s->k(chr..int$(?,2)..k$(str..s.index),groupsof(8,s[2:]))
k=''.join..map

Try it online!

GolfScript, 24 bytes
1>(:x;8/{{x=}%2base}%''+

Try it online!
Explanation:
1>(:x;8/{{x=}%2base}%''+ Full program, implicit input.
                         Stack: "ABAABBAAAAAABBAAABAABBAABA"
1>                       Pop the first character (str[1:])
                         Stack: "BAABBAAAAAABBAAABAABBAABA"
  (:x;                   Pop the next character and assign it to x
                         Stack: "AABBAAAAAABBAAABAABBAABA"; x = 66
      8/                 Split into groups of 8
                         Stack: ["AABBAAAA" "AABBAAAB" "AABBAABA"]; x = 66
        {          }%    Map
                           Stack (first run): "AABBAAAA"; x = 66
         {  }%             Map again
                             Stack (first run): 65; x = 66
          x=                 Compare to x
                             Stack: 0; x = 66
                           Stack: [0 0 1 1 0 0 0 0]; x = 66
                           Well, actually, it is a string of 0 and 1 bytes.
              2base        Convert binary string to number
                           Stack: 48; x = 66
                         Stack: [48 49 50]; x = 66
                     ''+ Convert to string
                         Stack: "012"; x = 66
                         Implicit output

Charcoal, 17 bytes
Ｆ⪪Ｅ✂θ²Ｌθ¹⌕θι⁸℅↨ι²

Try it online! Link is to verbose version of code. Explanation:
   ✂θ²Ｌθ¹           Slice first two characters from input
  Ｅ      ⌕θι        Replace each character with its index in the input
 ⪪          ⁸       Split into groups of 8
Ｆ                   Loop over each group
              ↨ι²   Convert from binary
             ℅      Convert from code to character
                    Implicitly print

Jelly, 8 bytes
ṫ3nḢs8ḄỌ

Try it online!
ṫ3nḢs8ḄỌ
ṫ3        All but first two characters...
  n       does not equal...
   Ḣ      the first character.
    s8    Split into groups of 8.
      Ḅ   Convert from binary (vectorizes).
       Ọ  chr() (vectorizes).

Jelly, 7 bytes
ḢnḊs8ḄỌ

Try it online!
Who needs ṫ (tail)?
Coincidentally Because there is only one way to do it,  the 4 last bytes are identical to dylnan's answer.

Actually there is another way, providing there are no leading NUL bytes in the output:
Jelly, 7 bytes
ḢnḊḄb⁹Ọ

Try it online!

C (gcc), 94 86 bytes (107 for leading whitespace)
Thanks to Jonathan Frech for saving 8 bytes!
f(s,v,i,j)char*s,*v;{for(v=++s,i=j=0;*++s;j&7||(putchar(i),i=0))i|=!(*s-*v)<<(--j&7);}

Try it online!

Original solution:
f(s,v,i,j)char*s,*v;{for(v=++s,i=j=0;*++s;){i|=!(*s-*v)<<(--j&7);if(!(j&7)){putchar(i);i=0;}}}

Try it online!
This assumes that main()'s stripping of whitespace is allowable. Otherwise, I got it to 107 bytes:
f(s,v,i,j)char*s,*v;{while(*s++<33);for(v=s,i=j=0;*++s;){i|=!(*s-*v)<<(--j&7);if(!(j&7)){putchar(i);i=0;}}}

Try it online!

86 bytes.

@JonathanFrech that's great! My brain hurts when looking at implicit if's, though. :-)

Implicit if's? You mean the short-circuiting or evaluation?

Here my take at golfing it j,v,i;f(char*s){for(v=*++s;*++s;--j&7||putchar(i))i=2*i|*s==v;}.

Perl 6, 82 bytes 79 bytes
{.[2..*].map({+($^s ne.[0])}).rotor(8)».join».parse-base(2)».chr with .comb}

Shortened with help from Phil H (but his solution is still shorter, so go look at his one)
Try it online!

You can shorten the block inside the map by just casting a bool to a number: {+($^s ne.[0])}

Perl 6, 59 bytes
{/(..)(.**8)*/;$1>>.trans(~$0=>"01")>>.parse-base(2)>>.chr}

Try it online!
Matches the pattern first, then uses a transliteration to 01 and parses the number.

bash + bc + xxd, 87 bytes
a="${1:2:${#1}}"
b="${a//${1::1}/0}"
bc<<<"obase=16;ibase=2;${b//${1:1:1}/1}"|xxd -r -p

Usage:
bash foo.bash 'ABAABBAAAAAABBAAABAABBAABA'

Thunno 2 B, 9 bytes
Ḣsḣ8ẇQ2ȷḋ

Try it online!
Explanations
Ḣsḣ8ẇQ2ȷḋ  # Implicit input, converted to charcodes
Ḣ          # Extract the first character from the input
 sḣ        # And remove the next character from the rest
   8ẇ      # Split it into groups of eight
     Q     # For each: is it not equal to the first character
       ȷ   # For each inner list in this nested list:
      2 ḋ  # Convert it back from binary to decimal
           # Implicit output, converted to characters

Old:
2ɱ$2ỵ8ẇsȷbC  # Implicit input
2ɱ           # Take the first two characters
  $2ỵ        # And then push the rest of the string
     8ẇ      # Split it into groups of eight
       sȷb   # Convert each from base-(first two characters)
          C  # Convert to characters
             # Implicit output

source: Stack Exchange

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

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

sort: votes


text:
Intermediate String Array Reflection
Let's start by re-defining a reflection of a character in a 2-d array of characters:

Given a square 2-d array of characters with distinct lowercase alphabetical letters, define a reflection of a letter in the matrix as swapping it with the character directly across from it through the center of the square.

Thus, a reflection of the letter c in
abcde
fghij
klmno
pqrst
uvwxy

would result in the configuration
abwde
fghij
klmno
pqrst
uvcxy

because the c and the w have been switched.
Some more examples (with the same original configuration as above):

Reflecting the character e would form

 abcdu
 fghij
 klmno
 pqrst
 evwxy

Reflecting the character m would make

 abcde
 fghij
 klmno
 pqrst
 uvwxy

Reflecting the character b would form

 axcde
 fghij
 klmno
 pqrst
 uvwby

The Challenge
Given a 2-d array of characters with distinct lowercase letters, go through each character in a given string and "reflect" it in the matrix.
Clarifications: The letters in the string are from a-z, the letters are unique, and the array is at least 1x1 and at most 5x5 (obviously, as there are only 26 characters in the English alphabet.) The characters in the string are guaranteed to be in the 2-d array. The string is at most 100 characters long.
Input
An string s, an integer N, and then a NxN array of characters.
Example
Input:
ac
2
ab
cd

Output:
dc
ba

*Reason: First, reflect the a with the d. Then, reflect the c with the b because c is the second letter in the input string.

Scoring

Output can be given by any convenient method.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Current Winner

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

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

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

Half an hour is not really enough time to get any meaningful use out of the sandbox.

Sigh I thought of that, but then I realized it was so much like my previous question that I didn't think it needed Sandbox. I apologize if this puzzle is bad :(

No problem, it looks good.

(also we have a Stack snippet leaderboard)

@user202729 Thanks! Should I give credit? Or is it just something everyone uses. Sorry, I'm kind of new to this.

50 hours is a bit too short of a time span to accept a winner; typically you'd want to wait a week or so. However, on PPCG, it's common practice to not accept any answers because that discourages future answers, and we want to keep challenges open forever.

@HyperNeutrino Thanks! This is very, very different from Puzzling SE which is where I spend the majority of my time, so thanks for letting me know! :D

@NL628 No problem! Glad to have you here

All you examples have the characters in alphabetical order. I assume that's not an assumption we can make? Also, do we have to take N as an input if we don't need it?

"The string is at most 100 characters long". Does that mean we can get input: 'aaaabbaabbaabaccccaac',2,'ab\ncd'? I think you should give a test case like that, if it's a possible input.

Can we take the character array as a string instead?

Python 2, 76 bytes
lambda s,a:[a[[i,~i][(s.count(c)+s.count(a[~i]))%2]]for i,c in enumerate(a)]

Try it online!
Takes input:

s: string
N: ignored
a: joined string of chars

Returns a flat list of chars

If I have to take the array as a list:
Python 2, 111 108 107 104 bytes
lambda s,n,a:[[x[sum(map(s.count,x))%2]for i in range(n)for x in[[a[j][i],a[~j][~i]]]]for j in range(n)]

Try it online!
Takes input:

s: string
n: int
a: 2D lists of chars

Returns a 2D list of chars

Octave, 85 68 66 bytes
Using eval, with a loop inside it saved a lot of bytes! I got the inspiration from this answer by Luis Mendo!
@(c,N,A)eval"for C=c,A(flip(k))=A(k=[x=find(A==C),N^2+1-x]);end,A"

Try it online!
Explanation:
f=@(c,N,A)          % Anonymous function that takes the three input variables
eval"...          % Evaluate the string and run it:
 for C=c,          % Loop over the character list 'c'
  .. x=find(A==C)   % Find the index where the character C is in A, and store it as 'x'
  .. k=[x,N^2+1-x]  % Create a vector with the index of C, and the index of its reflection
   A(flip(k))=A(k)  % Swap the elements in these positions
  end               % End loop
  A"                % Display the new 'A'

R, 74 61 bytes
-13 bytes thanks to Giuseppe.
function(s,n,m){for(x in s)m[v]=rev(m[v<-(i=x==m)|rev(i)]);m}

Try it online!
Inputs a vector of characters to search as s, size of the matrix as n and matrix itself as m. If it is absolutely necessary to take the first argument as string, that would pretty much spoil the fun.

Using logical rather than numeric indices, I golfed down to 61 bytes

Java 10, 126 123 116 114 bytes
(s,n,m)->{for(var c:s)for(int N=n*n,i,j;N-->0;)if(m[i=N/n][j=N%n]==c){m[i][j]=m[n+~i][n+~j];m[n+~i][n+~j]=c;N=0;}}

Modifies the input character-matrix instead of returning a new one to save bytes.
Try it online.
Explanation:
(s,n,m)->{     // Method with the three parameters and no return-type
  for(var c:s) //  Loop over the characters given:
    for(int N=n*n,i,j;N-->0;)
               //   Inner loop over the cells of the matrix:
      if(m[i=N/n][j=N%n]==c){
               //    If the current character and matrix-value are equals:
        m[i][j]=m[n+~i][n+~j];m[n+~i][n+~j]=c;
               //     Swap the values in the matrix at indices [i, j] and [n-i-1, n-j-1]
        N=0;}} //     And stop the inner loop (go to next iteration of the outer loop)

Jelly, 15 14 bytes
FW;Ṛi,C$¥¦/ṁḷY

Try it online!
Full program.
Explanation:

FW;Ṛi,C$¥¦/ṁḷY       Main link. Input: ['ab','cd'] (left), 'ac' (right).
FW                   Flatten and Wrap it in a list. Current value = ['abcd'].
  ;                  Concatenate it with right argument. ['abcd','a','c']
          /          Reduce from left:
   Ṛ     ¦             Apply Ṛeverse at...
    i   ¥              the index (of right argument in left argument)...
     ,C$               and its complement index.

The last operation needs more explanation. Denote f = Ṛi,C$¥¦, then for value ['abcd','a','c'] it computes ('abcd' f 'a') f 'c', which expands to:

Ṛi,C$¥¦    Function f. Assume left argument = 'abcd' and right argument = 'a'
Ṛ          First, compute the reverse. Get 'dcba'.
 i   ¥     To compute the indices to apply to, first the index of 'a' in 'abcd'
             is ('abcd' i 'a') = 1. (first index)
  ,C$      Then pair with (1 C) = 0. (last index)
      ¦    Apply 'dcba' to 'abcd' at indices 0 and 1:

              abcd
              dcba
              ^1 ^0
              ====
              dbca

Java (JDK), 95 93 bytes
(x,s,N)->{for(var c:s)for(int i=-1;++i<N;){var t=x[i];if(t==c){x[i]=x[N+~i];x[N+~i]=t;i=N;}}}

Try it online!
Java (JDK), 131 bytes
(x,s,n)->{for(var c:s)for(int i=~0;++i<n*n;){int a=i/n,b=i%n;var t=x[a][b];if(t==c){x[a][b]=x[n+~a][n+~b];x[n+~a][n+~b]=t;break;}}}

Java (JDK), 138 135 bytes
(x,s,n)->s.forEach(c->{for(int i=~0,a=i/n,b=i%n;++i<n*n;){var t=x[a][b];if(t==(char)c){x[a][b]=x[n+~a][n+~b];x[n+~a][n+~b]=t;break;}}})

Java (JDK), 112 bytes
(x,s,N)->{for(var c:s)for(var v:x.entrySet())if(v.getValue()==N-x.get(c))x.put(v.getKey(),x.put(c,N-x.get(c)));}

Try it online!
Java (JDK), 70 bytes
(x,X,s,N)->{for(var c:s)x.put(X.get(N-x.get(c)),x.put(c,N-x.get(c)));}

Try it online!
All of these code snippets function in essentially the same way since only difference between them is the type of the variable x. The first has it set as char[], the second as char[][] and the third as List<Object>. The fourth and fifth are quite unique solutions, and so I'll go over the specific details of them last. As somewhat of a side note, the first of these three entries inputs the total quantity of elements in the initial array (i.e., N = n * n).
Here's how the first three entries work:
(array, reflect, size) -> {            // Initializes lambda expression
    for (char c: reflect)              // Loops through soon-to-be reflected characters
        for (int i = 0; i < size; i++) // Loops through elements in array
            if (array[i] == c)         // Checks if this element should be reflected
            {
                var temp = array[i];   // Reflects elements
                array[i] = array[size - 1 - i];
                array[size - 1 - i] = temp;
                break;                 // Goes on to reflect next character
            }
};

I feel like these entries can be further golfed with use of nested functions and lambda expressions, but I have been unable to do so thus far. I instead went on to create the fourth entry, as shown below in all of its golfed glory:
(x,s,N)->{
    for(var c:s)
        for(var v:x.entrySet())
            if(v.getValue()==N-x.get(c))
                x.put(v.getKey(),x.put(c,N-x.get(c)));
}

The fifth is quite similar. These particular lambda expressions are unique, in the sense that s is an Object[] and N is one less than the total quantity of elements in the initial array. But most importantly, x is a LinkedHashMap<Object, Integer>. Well, what's so special about all of that? The idea behind changing all of these things was to allow for a short for loop going over the elements of s, thus ridding the program of tightly packing for loops with ugly garbage. It essentially simplified things for the code and I. Unfortunately, doing so would mean indexing the initial array to find the index of each element, contradicting its intended purpose.
It was at that moment that I realized that replacing the array input with some Map subclass would allow me to use the elements to be reflected as a way to index the elements in the array directly. So I did the only logical solution: map half of the array elements to their corresponding pairs to simplify reflection. Didn't work, big surprise. But I didn't give up and mapped each element to its corresponding array index and the idea was looking good. Next problem: given an element in the array, finding its reflective pair couldn't be done without more for loops, if statements and precious bytes altogether. But a more immediate problem came from this, too: printing the array. In retrospect, it would've been possible to instead input a copy of the array and use the original's elements to get the key-value pairs, but I found a better solution: the LinkedHashMap. This class contains the nested class Entry, which allows for much simpler key-value pairing, which just so happened to be at the root of both problems.
So now that I've gone over why I made these changes and how the base of this setup should work, I'll use what we've learned to give the code some more context:
(x,s,N)->{ // Initializing lambda expression
    for(var c:s) // Looping over elements to be reflected
        for(var v:x.entrySet()) // Looping over key-value pairs...
            if(v.getValue()==N-x.get(c)) // ...until element opposite current is found
                x.put(v.getKey(),x.put(c,N-x.get(c))); // Swapping elements
}

You should note that the line involving the actual reflection has a nested put method, because it returns the key that was changed, thus removing an extra variable initialization for the swapping process.
But what about my fifth entry? Am I taking this simple challenge too seriously? Yes! This solution has a very low byte count, because it's the same as the fourth, but with an extra input: X. Unlike x, which is the array converted to a LinkedHashMap<Object, Integer>, X is the reverse: a LinkedHashMap<Integer, Object>. This allows us to skip searching for any element's index and instead just look it up in X, thus removing a lot of code.
As a final side note, the only entries that allow more characters to be reflected than there are in the initial array are the fourth and fifth. Will this be the end?
Thanks to @KevinCruijssen for the inspiration and for saving two bytes from my first entry.

Welcome to Code Golf! You may want to check out our Tips for golfing in Java.

You can save 2 bytes in your top answer by changing break; to i=N;.

C, 84 86 83 bytes
+2 bytes to use a temporary variable instead of chained XOR when swapping variables, allowing for the central letter to be swapped with itself
-3 bytes thanks to ceilingcat.
f(s,n,a,i,j,t)char*s,*a,*i;{for(;*s;*i=t)i=index(a,*s++),t=a[j=a-i+n*n-1],a[j]=*i;}

Try it online!
Un-golfed:
f(s,n,a,i,j,t)
    char*s,*a,*i;
{
    for(;*s;*i=t) { //Loop while end of s hasn't been reached
        i=index(a,*s++); //i = pointer to char in a with value *s, then get next char s
        t=a[j=a-i+n*n-1]; //j = index of char in a which is opposite i, then swap i and a[j]
        a[j]=*i;
    }
}

Retina 0.8.2, 96 bytes
+`^(.)(.*¶(.|¶)*)((.)((.|¶)*))?\1(?(4)|(((.|¶)*)(.))?)((?<-3>.|¶)*$(?(3).))
$2$11$9$1$6$5$12
1A`

Try it online! Takes the string s and the array of characters as a newline-delimited string without the integer N. Explanation: Each character c of s is processed in turn. The regex matches two positions equidistant from the ends of the array, of which one is c and the other is its mirror m. These characters are swapped and c is removed from s.
+`

Processes each character of s in turn.
^(.)

$1 captures c.
(.*¶(.|¶)*)

$3 captures a stack of characters in the array prefixing one of c or m. $2 captures the rest of s plus all of these characters.
((.)((.|¶)*))?

If m precedes c, $4 has a value, $5 captures m and $6 captures the characters between m and c. $7 captures $6 as a stack but its value is not used.
\1

c is now matched in the array itself.
(?(4)|(((.|¶)*)(.))?)

If m wasn't already matched, then $8 optionally captures a value, in which case $9 captures the characters from c to m, $10 captures $9 as a stack which is unused and $11 captures m. The value is optional in case c and m are the same character.
((?<-3>.|¶)*$(?(3).))

$12 captures the characters suffixing the other of c and m. A balancing group is used to ensure $12 is as long as $3 was deep, i.e. the prefix and suffix are the same length.
$2$11$9$1$6$5$12

The pieces are then put back together - first the rest of s and the prefix of the array, then if c preceeded m then m then the middle, then c, then if m preceeded c then the middle then m, then the suffix.
1A`

Now that s is empty it is deleted.

Python 3, 122 111 bytes
lambda l,n,A:[[[A[a][b],A[~b][~a]][sum(map(l.count,[A[a][b],A[~b][~a]]))%2]for b in range(n)]for a in range(n)]

Try it online!
Returns a 2D array of chars.

You should be able to golf this further.. No way modifying the input matrix is shorter in Java than in Python.. ;p To get you started (and making it 1 byte shorter instead of 1 byte longer than my Java answer): Removing the a and b and using n+~x and n+~y directly saves 2 bytes: a,b=n+~x,n+~y;A[x][y],A[a][b]=A[a][b],A[x][y] to A[x][y],A[n+~x][n+~y]=A[n+~x][n+~y],A[x][y]

Perl 5 -lpF, 97 bytes
$i=0|<>;$_=join'',<>;s/\W//g;for$k(@F){/$k/g;$t=substr$_,-pos,1;eval"y/$t$k/$k$t/"}s%.{$i}%$&$/%g

Try it online!

JavaScript, 85 bytes
Takes string S and an array A as joined string.
([...S],[...A])=>S.map(c=>[A[j],A[i]]=[A[i=A.indexOf(c)],A[j=A.length+~i]])&&A.join``

f=
([...S],[...A])=>S.map(c=>[A[j],A[i]]=[A[i=A.indexOf(c)],A[j=A.length+~i]])&&A.join``

console.log(
  f('abcd','ac')
)

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


text:
How to swap elements in a vector using an anonymous function in Octave?
Swapping two elements in a vector/matrix is very simple in Octave:
x='abcde';
x([4,1])=x([1,4])
x =
   dbcae

Unfortunately, I have yet to find a way to do this inside an anonymous function. While the function below is syntactically correct, it only gives back the two elements that are swapped, not the entire x vector:
f=@(x)(x([4,1])=x([1,4]))
f(x)
ans =
     ad

Is there a way to achieve the desired behavior using anonymous functions in a golfy way? Can several elements be swapped this way using an anonymous function?
I could create an indexing vector: f=@(x)x([4,2,3,1,5]), but creating such a vector dynamically will likely take a lot of bytes too.

Relevant meta post.

Argument List
f=@(x,y=x([4 1])=x([1 4]))x;

Try it online!

Wait what? I never knew this was possible in Octave. This opens up so many new techniques....

What in the...?

Please post this in the Tips for Octave question! With this technique, you can basically do everything in the argument list, so you never need to choose between a 'full' and anonymous function again. I'm shocked.

Amazing. BTW, you can remove the final ; for the purposes of byte count

Thanks to all .@Sanchises It seems that Octave is a shocking language. Be careful! It is added to tips.

@LuisMendo, you can't actually. Not sure why though... Try it.

@StewieGriffin Just move the ; to the footer; see here

That feels like cheating... I know it's pretty much the same as moving the f=... to the header. The difference is that the function would still work with ans('abc') if we remove f=..., but it's a syntax error without the ;.

@StewieGriffin and LuisMendo  I think it is a bug. It can be used in arrayfun,cellfun...

Be eval
f=@(x)eval"x([4 1])=x([1 4])"

Try it online!

In Matlab the parentheses cannot be omitted:
f=@(x)eval('x([4 1])=x([1 4])')

Only on PPCG is eval the answer :-)

Do you want to add this to the Octave tips question? for loop inside an anonymous function using eval saved a lot of bytes there, and can probably do it on many other challenges too,,,

Not sure if it is ever golfier, but I suppose you can do it even without anonymous function: s='x([1 4])=x([4 1])';eval(s) -- I suppose this is mostly interesting if you already made a function to do eval with minimal chars.

@StewieGriffin I think you should add it. Thanks for asking!

Added :)

I think this answer is the only one thusfar that is both valid Octave and Matlab.

@StewieGriffin Thanks! Now it's even eviller

Are you sure about the parentheses in Matlab? I thought a single space and apostrophes was enough. I might be wrong though...

I think it should work if you use commas as the delimiter at least..?

Cell array
One option is to use a cell array, like this:
f=@(x){x([1,4])=x([4,1]);x}{2}

Try it online!

Nice one! Reminds me of this trick

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


text:
Digit Product Sequences
Here's an interesting sequence discovered by Paul Loomis, a mathematician at Bloomsburg University. From his page on this sequence:
Define
f(n) = f(n-1) + (the product of the nonzero digits of f(n-1))
f(0) = x, with x as any positive integer, written in base 10.
So, starting with f(0)=1, you get the following sequence
1, 2, 4, 8, 16, 22, 26, 38, 62, 74, 102, 104, ...
So far, so standard. The interesting property comes into play when you take any other integer as the starting point, eventually the sequence converges into a point along the above x=1 sequence. For example, starting with x=3 yields
3, 6, 12, 14, 18, 26, 38, 62, 74, 102, ...
Here are some more sequences, each shown only until they reach 102:
5, 10, 11, 12, 14, 18, 26, 38, 62, 74, 102, ...
7, 14, 18, 26, 38, 62, 74, 102, ...
9, 18, 26, 38, 62, 74, 102, ...
13, 16, 22, 26, 38, 62, 74, 102, ...
15, 20, 22, 26, 38, 62, 74, 102, ...
17, 24, 32, 38, 62, 74, 102, ...
19, 28, 44, 60, 66, 102, ...

He conjectured, and empirically proved up to x=1,000,000, that this property (i.e., that all input numbers converge to the same sequence) holds true.
The Challenge
Given a positive input integer 0 < x < 1,000,000, output the number where the f(x) sequence converges to the f(1) sequence. For example, for x=5, this would be 26, since that's the first number in common to both sequences.
 x output
 1 1
 5 26
19 102
63 150056

Rules

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

JavaScript (ES6), 81 67 bytes
Saved 1 byte thanks to @l4m2
f=(n,x=1)=>x<n?f(x,n):x>n?f(+[...n+''].reduce((p,i)=>p*i||p)+n,x):n

Try it online!
Commented
f = (n,                   // n = current value for the 1st sequence, initialized to input
        x = 1) =>         // x = current value for the 2nd sequence, initialized to 1
  x < n ?                 // if x is less than n:
    f(x, n)               //   swap the sequences by doing a recursive call to f(x, n)
  :                       // else:
    x > n ?               //   if x is greater than n:
      f(                  //     do a recursive call with the next term of the 1st sequence:
        +[...n + '']      //       coerce n to a string and split it
        .reduce((p, i) => //       for each digit i in n:
          p * i || p      //         multiply p by i, or let p unchanged if i is zero
        ) + n,            //       end of reduce(); add n to the result
        x                 //       let x unchanged
      )                   //     end of recursive call
    :                     //   else:
      n                   //     return n

f=(n,x=1)=>x<n?f(x,n):x>n?f(+[...n+''].reduce((p,i)=>p*i||p)+n,x):n

Jelly, 18 14 bytes
ḊḢDo1P+Ʋ;µQƑ¿Ḣ

Input is a singleton array.
Try it online!
How it works
ḊḢDo1P+Ʋ;µQƑ¿Ḣ  Main link. Argument: [n]

            ¿   While...
          QƑ      all elements of the return value are unique...
         µ          execute the chain to the left.
Ḋ                     Dequeue; remove the first item.
 Ḣ                    Head; extract the first item.
                      This yields the second item of the return value if it has
                      at least two elements, 0 otherwise.
       Ʋ              Combine the links to the left into a chain.
  D                     Take the decimal digits of the second item.
   o1                   Perform logical OR with 1, replacing 0's with 1's.
     P                  Take the product.
      +                 Add the product with the second item.
        ;             Prepend the result to the previous return value.
             Ḣ  Head; extract the first item.

Python 2, 78 bytes
f=lambda a,b=1:a*(a==b)or f(*sorted([a+eval('*'.join(`a`.replace(*'01'))),b]))

Try it online!

I was working on solution with lambda, but got stuck with shortcircuting for couple minutes, good job!

Haskell, 65 bytes
(!1)
a!b|a>b=b!a|a<b=(a+product[read[d]|d<-show a,d>'0'])!b|1<2=a

Try it online!

Husk, 13 bytes
→UΞm¡S+ȯΠf±dΘ

Takes input as a singleton list.
Try it online!
Explanation
                 Implicit input, e.g 5
            Θ    Prepend a zero to get  [0,5]
   m             Map the following over [0,5]
    ¡              Iteratatively apply the following function, collecting the return values in a list
           d         Convert to a list of digits
         f±          keep only the truthy ones
       ȯΠ            then take the product
     S+              add that to the original number
                After this map, we have [[0,1,2,4,8,16,22,26,38,62...],[5,10,11,12,14,18,26,38,62,74...]]
  Ξ             Merge the sorted lists:  [0,1,2,4,5,8,10,11,12,14,16,18,22,26,26,38,38,62,62,74...]
 U              Take the longest unique prefix: [0,1,2,4,5,8,10,11,12,14,16,18,22,26]
→               Get the last element and implicitely output: 26

Python 2, 111 95 93 bytes
Using unpacking in replace(*'01') as in @Rod answer
-18 bytes thanks to @Lynn
l=[1,input()]
while cmp(*l):l[0]+=eval('*'.join(`l[0]`.replace(*'01')));l.sort()
print l[0]

Try it online!

Ah, and the loop condition can be while cmp(*l), also!

@Lynn Yes! Thanks again

Java (JDK 10), 99 bytes
n->{for(int x=1;x!=n;n+=(""+n).chars().reduce(1,(a,b)->a*(b>48?b-48:1)))x^=x<n?n^(n=x):0;return n;}

Try it online!
Mostly an iterative port of Arnauld's JavaScript answer, so go upvote him!

Python 3, 126 125 bytes
m=[1]
n=[int(input())]
while not{*m}&{*n}:
 for l in m,n:l+=l[-1]+eval('*'.join(str(l[-1]).replace(*'01'))),
print({*m}&{*n})

Try it online!
Take the input as string

J, 50 bytes
tacit style function definition
[:{.@(e.~#])/[:(+[:*/@(*#])(#~10)&#:)^:(<453)"0,&1

if the argument (say 63) were pasted into a REPL expression it could be 45 e.g.
{.(e.~#])/(+[:*/@(*#])(#~10)&#:)^:(<453)"0]1,63

,&1 append 1 to generate search sequence as well as argument's sequence
^:(<453)"0 iterates each until 1mio is reached in 1's sequence
+ [: */@(*#]) (#~10)&#: fork adds to hook which does the product of digits
(e.~ # ])/ uses repeat item if exists to get intersection of lists
{. return only the first common value

Try it online!

R, 110 86 bytes
o=c(1,1:9);o=o%o%o%o%o;o=c(o%o%o)
x=c(1,n);while((x=sort(x))<x[2])x[1]=(x+o[x+1])[1]
x

TIO
previous version 110:
f=function(x){if((x[1]=x[1]+(c((y=(y=c(1,1:9))%o%y%o%y)%o%y))[x[1]+1])==x[2]){x[1]}else{f(sort(x))}}
f(c(1,n))

TIO

Jelly, 23 bytes
ð⁹1,Dḟ0P+Ʋ⁸Ð¡€f/©µ1#ṛ®Ḣ

Try it online!


text:
Ot wes thi bist uf tomis
I just love this simple cypher, it's so fun reading not-quite human-readable words and filling the gaps...
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis,
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss,
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty,
ot wes thi siesun uf loght, ot wes thi siesun uf derkniss,
ot wes thi sprong uf hupi, ot wes thi wontir uf dispeor,
wi hed ivirythong bifuri as, wi hed nuthong bifuri as,
wi wiri ell guong dorict tu hievin, wi wiri ell guong dorict thi uthir wey –
on shurt, thi piroud wes su fer loki thi prisint piroud,
thet sumi uf ots nuosoist eathurotois onsostid un ots biong riciovid,
fur guud ur fur ivol, on thi sapirletovi digrii uf cumperosun unly.

The rules are super-simple:

Accept some text as input (ascii characters, upper/lower case letters and punctuation).
For each vowel, rotate it to the next vowel, or back to the start.

a => e
e => i
i => o
o => u
u => a

Upper case vowels stay upper case, lower case vowels stay lower case.
Output the text after these conversions.
No need to support accents.
The all other characters should remain unchanged.
Try to do it in the smallest number of bytes.
Any old language you like.

Test Cases
It was the best of times, it was the worst of times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of light, it was the season of darkness,
it was the spring of hope, it was the winter of despair,
we had everything before us, we had nothing before us,
we were all going direct to heaven, we were all going direct the other way –
in short, the period was so far like the present period,
that some of its noisiest authorities insisted on its being received,
for good or for evil, in the superlative degree of comparison only.

Out:
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis,
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss,
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty,
ot wes thi siesun uf loght, ot wes thi siesun uf derkniss,
ot wes thi sprong uf hupi, ot wes thi wontir uf dispeor,
wi hed ivirythong bifuri as, wi hed nuthong bifuri as,
wi wiri ell guong dorict tu hievin, wi wiri ell guong dorict thi uthir wey –
on shurt, thi piroud wes su fer loki thi prisint piroud,
thet sumi uf ots nuosoist eathurotois onsostid un ots biong riciovid,
fur guud ur fur ivol, on thi sapirletovi digrii uf cumperosun unly.

In:
The quick brown fox jumps over the lazy dog.

Out:
Thi qaock bruwn fux jamps uvir thi lezy dug.

In:
Home is where the heart is.

Out:
Humi os whiri thi hiert os.

In:
Boaty McBoatface

Out:
Buety McBuetfeci

In:
AEIOUaeiou

Out:
EIOUAeioua

In:
Programming Puzzles And Code Golf

Out:
Prugremmong Pazzlis End Cudi Gulf

Related

A.k.a. The Great Vowel Shift

@Angs A Tale Of Two Cases?

Hmm. Olde English?

Related

Still an easier read than Beowulf.

If you think it's fun to read this stuff, I can recommend a book named Feersum Endjinn by Iain M. Banks. It has entire chapters written like this.

Looks like a kiwi-translater to me.

I like how “evil” when ciphers to “ivol”, is effectively pronounced the same way.

For English it looks strange because it transforms some silent vowels (like in "have" into spoken ones (like "hevi").

Stax, 7 bytes
öΦΣòC└∞

Run and debug it
Try it online!
Explanation (unpacked)
Vv:tVV:t
Vv:t           #Push aeiou and ring translate it to input
    VV:t       #Push AEIOU and ring translate it to input

Might be able to save more, will keep trying.

MS-SQL, 51 Bytes
Works on SQL 2017 or above:
SELECT TRANSLATE(v,'AEIOUaeiou','EIOUAeioua')FROM t

The new function TRANSLATE performs individual character replacement, so is ideally suited for this challenge.
Input is via a pre-existing table t with varchar column v, per our IO rules.
In this case the table must be created using a case-sensitive collation, either by running on a case-sensitive server, or by using the COLLATE keyword (not counted toward character total):
CREATE TABLE t(v varchar(max) COLLATE Latin1_General_CS_AS)

EDIT: SSMS may cut off the lengthy quote above when returning the result in a "results to text" window, this is a client setting, not a bug in my program.
To fix, go to Tools > Options > Query Results > SQL Server > Results to Text and increase the "Maximum number of characters displayed in each column."

I'm genuinely shocked that SQL is even close to competitive for this. Also, that's a cool function! Thanks for telling us :)

@NicHartley Yeah, they seem to add a couple useful functions each version. You can nest it with REPLACE for some tricks as well: REPLACE(TRANSLATE(v,'1234567890','xxxxxxxxxx'),'x','') to eliminate all numerals from a string, for example. Still long, but much shorter than 10 nested REPLACEs.

Bash + coreutils, 24
tr aeiouAEIOU eiouaEIOUA

Try it online!

Haskell, 52 bytes
(a:b)!c|a/=c=b!c|1>0=b!!0
a!b=b
map("aeiouaAEIOUA"!)

Try it online!
Lynn saved me two bytes by pointing out that !!0 is shorter than head.
Explanation
If you have never coded in Haskell this will probably look like a pile of jibberish.  So first let's ungolf it and then break it down:
(a:b)!c
 |   a/=c   = b!c
 |otherwise = b!!0
a!b=b
map("aeiouaAEIOUA"!)

First we have a function !, which takes a string s and a character c.  Our first pattern match catches accepts input if the string is non-empty. If the string is non-empty we compare its first character to c.  If it's first character is not equal to c we toss it and call ! again with the remainder of the string and c.  If it is equal we return the second character in the string.
Our next pattern match catches the string in all other cases, that is if the string is empty. In this case we just return c.
All in all this function takes a character c and a string s and returns the character after the first occurrence of c in s.  If we pass this with aeiouaAEIOUA it will perform our cipher on a single character.  To make our whole function we ought to map this across the string.

Retina, 10 9 8 bytes
T`uo`vVA

Try it online!
Saved 1 byte thanks to Neil! And another byte thanks to Martin!
The new version of retina has vowel classes, which makes the result a bit shorter. The transliteration also makes use of the "other" class. So the to class looks like "aeiouAEIOUA" while the from class looks like "uaeiouAEIOUA"
This doesn't cause any problems since the second u mapping to A will never be done since u was already mapped to a.

9 bytes: T`_o`uvUV.

This is a remarkably short answer!

@Neil clever, thanks! I thought putting an _ in the from set would treat it literally, but it looks like it doesn't do that.

You can shave off one more, but I can't seem to tie Stax, unfortunately: https://tio.run/##HYnBDoIwEAXv/Yr3BSR@AhqjHowcxDMrLFClXV1aEH4e0dNMZpSD9bRZlmsRpRhu6Wot4x1t@cRdZfSo5YNHdK8eMrAirLujeUIlTWKO4hi2x9iy8v@1TBrWlJitUJhwLn@sqWST7k@XnNhKNJlKo@Sc9Q2yOM8d90h9hZ1UjIN09Rc

@MartinEnder Thanks! That's a clever setup, mixing between the two. I haven't tried using Y much yet so I'll give that a shot tomorrow.

@FryAmTheEggman I don't think it helps here. The "cyclic" in the name has little to do with the "cyclic" in this challenge (it means that the mapping for each character cycles through various resulting characters as you transliterate the string). Let me know if you do find a shorter solution though.

Perl 5 + -p, 24 23 bytes
y;AEIOUaeiou;EIOUAeioua

Try it online
-1 byte thanks to @DomHastings

We don't count -p as +1 anymore, instead we consider that this answer is in "Perl 5 + -p".

This also works in sed

If you use ; as the delimiter you can save a byte!

updated, @Cowsquack not anymore

Python 3, 62 59 bytes
lambda x:x.translate(dict(zip(b'aeiouAEIOU','eiouaEIOUA')))

Make a translation table (dictionary) with str's static str.maketrans method. Translate relevant characters to their destination character.
EDIT: Saved 3 bytes by using the dict constructor to make the translation table instead of the str#maketrans method

Where does this perform I/O?

@reinierpost It's a function. The input is via the x parameter. In python, lambda functions don't need a return statement.

C, 85 76 67 65 64 bytes
f(char*c){for(;*c;)putchar(1[index("AEIOUAaeioua",*c++)?:c-2]);}

Port of Kevin Cruijssen's Java answer. Try it online here.
Thanks to Kevin Cruijssen for golfing 9 bytes, to Christoph for golfing 11 bytes and to ceilingcat for golfing 1 byte.
Ungolfed version:
f(char* c) { // function taking a char array as parameter and implicitly returning an unused int
    for(; *c ;) // loop over the input
        putchar(1 [index("AEIOUAaeioua", * c++) ?: c-2]); // find the first pointer to the current char in the vowels string, NULL if not present; if it's not NULL, print the next vowel, otherwise just print the char
}

You can save 7 bytes by using "AEIOUAaeioua" directly, so you can drop int*t=...;, since you only use t once.

Oh, and one more byte with either this: f(char*c){for(char*p;*c;c++)putchar((p=strchr("AEIOUAaeioua",*c))?*++p:*c);}. Or this: f(char*c){for(char*p;*c;putchar(p?*++p:*c),c++)p=strchr("AEIOUAaeioua",*c);}

@KevinCruijssen Thanks!

f(char*c){for(;*c;)putchar((strchr("AEIOUAaeioua",*c++)?:c-2)[1]);} works for me (gcc 7.3).

@Christoph very nice. I had no idea you could leave out the second operand to ?:.

Seems to be a none standard extension from gcc. I knew it from php and simply tried it.

Can we output a final "\0"? If yes then f(char*c){putchar((strchr("AEIOUAaeioua",*c++)?:c-2)[1])&&f(c);} works just fine.

@Christoph I like your use of recursion, but I'm not sure we can output a trailing \0. Also, this does not work when compiled with clang: https://tio.run/##S9ZNzknMS///P00jOSOxSCtZs7qgtATE1NAoLilKzijSUHJ09fQPdUxMzcwvTVTS0UrW1ta0t0rWNdKMNozVVFMD6tS0rv2fm5iZp6GpUM3Fmaah5FmiUJ5YrFCSkaqQlFpcopCfplCSmZtarKOQiZApzy9CllLStOaq/Q8A

@Christoph: I was curious where the undefined behaviour was, so I debugged the clang version, after ungolfing it some more.  const char *res = strchr("AEIOU...", 0) returns a pointer to terminator in the string literal.  putchar(res[1]) reads past the end of the string literal.  With gcc it apparently happens to find another zero byte and it happens to work, but with clang it gets a 73 'I' (probably from main's string literal, "It was...", but I didn't check the asm).  So putchar doesn't return 0, and we eventually segfault when *c++ reads an unmapped page.

@PeterCordes yeah I found out about it here after having a suspicion. Anyway here another 2 bytes saved f(char*c){for(;*c;)putchar(1[strchr("AEIOUAaeioua",*c++)?:c-2]);}. That's all for now I guess.

I'm curious as to what does 1[…] do?

@Rogem Because of the commutative property of addition, a[b]==*(a+b)==*(b+a)==b[a]. Therefore 1[...]==(...)[1]

The ungolfed version should really have the array indexing the "traditional" way around.

R, 43 bytes
chartr("AEIOUaeiou","EIOUAeioua",scan(,""))

Try it online!
Here's my solution wrapped in a cat to get it to print out more nicely: Try it online!

Python 2, 79 68 67 bytes
-1 byte thanks to @ArnoldPalmer
V='uaeiouAEIOUA'
print''.join((V[1:]+c)[V.find(c)]for c in input())

Try it online!

67 bytes. Also, sorry if you got flooded with notifications, I haven't posted a comment in a while and forgot how to do it.

@ArnoldPalmer Thanks! It's ok, I was away and they all missed me :D

JavaScript (ES6), 60 bytes
s=>s.replace(/./g,c=>(S='aeiouaAEIOUA'+c+c)[S.indexOf(c)+1])

Try it online!

s=>s.replace(/./g,c=>'auoieaAUOIEA'.match(".(?=${c})")||c)

Error: only. => unlya

Ruby -p, 31 bytes
$_.tr!"AEIOUaeiou","EIOUAeioua"

Try it online!

Jelly, 11 bytes
Øcs5ṙ€-Ẏ,Ʋy

Try it online!

Japt 2.0, 25 21 bytes
I had fun golfing this one with Shaggy.
r\v@=`aeia`pu)g1+UbX

Run it here.

23 bytes

@Shaggy That doesn't work with capital vowels.

In that case ... 22 bytes.

@Shaggy This is fun...21 bytes

Nice! I think that's the first time I've seen S.p(f) used.

@Shaggy Yeah, same. I tried it on a whim, and was surprised that it actually worked :P

Java 10, 97 87 bytes
s->{for(var c:s){var t="AEIOUAaeioua"+c+c;System.out.print(t.charAt(t.indexOf(c)+1));}}

-10 bytes after being inspired by @Arnauld's JavaScript answer (his 60-bytes version).
Try it online.
Explanation:
s->{                         // Method with character-array parameter and no return-type
  for(var c:s){              //  Loop over the input characters
    var t="AEIOUAaeioua"     //  Temp-String containing the order of vowels
                             //  (including additional 'A' and 'a'),
          +c+c;              //  appended with two times the current character
    System.out.print(        //  Print:
      t.charAt(              //   The character in String `t` at index:
         t.indexOf(c)+1));}} //    The (first) index of the current character in `t` + 1

05AB1E, 14 13 11 bytes
žMDÀ‡žMuDÀ‡

Try it online!

You can save two bytes by simply taking the input as a multi-line string, so there is no need for the | and »: Try it online: 11 bytes.

@KevinCruijssen Thanks ! Isn't that something that was fixed in a recent 05AB1E release ?

No idea tbh. Only started 05AB1E since about the start of this year. You could ask @Adnan in the 05AB1E chat when the feature was added if you want to know.

Pyth, 17 bytes
em=.rQdrB"aeiou"1

Try it here
em=.rQdrB"aeiou"1
 m                  For each string...
       rB"aeiou"1   ... in ['aeiou', 'AEIOU']...
  =.rQd             ... cyclically rotate the characters in the input.
e                   Take the last.

Elm, 127 123 121 112 103 bytes
9 bytes saved by Hydrazer
f a b=case a of
 c::d::e->if c==b then d else f(d::e)b
 _->b
String.map(String.toList"aeiouaAEIOUA"|>f)

Explanation
This Elm answer is a port of my Haskell answer.  I am still learning Elm so there might be a good deal of golfing that can be done.  There are a couple of differences here between Elm and Haskell.  Elm does not allow multiple declarations of a function so we have to use case instead. Elm is also rather fussy about strings.  They are not list of characters and thus have to be treated differently then lists.  In fact in order to do any useful of manipulations on strings we pretty much have to just convert them to lists.  Aside from that there are a couple of small differences :: is the list cons operator and (|>)=flip($).
You can test the code here, with the following wrapper:
import Html exposing (text)
f a b=case a of
 c::d::e->if c==b then d else f(d::e)b
 _->b
g=String.map(String.toList"aeiouaAEIOUA"|>f)
main=g"It was a dark and stormy night"|>text

you can just use String String.map / String.toList instead of importing

Mumps, 38 bytes
R T W $TR(T,"AEIOUaeiou","EIOUAeioua")

Mumps doesn't normally add a carriage return, as I didn't see a requirement to separate input from output it does look a bit weird on first run. For example, the output for the last test case looks like this:
Programming Puzzles And Code GolfPrugremmong Pazzlis End Cudi Gulf

If you did want to add a carriage return, add two bytes thusly:
R T W !,$TR(T,"AEIOUaeiou","EIOUAeioua")

Vim + tpope/vim-abolish, 30 bytes
:%S/{a,e,i,o,u}/{e,i,o,u,a}/g<cr>

Alternate solution, also 30 bytes:
Oe,i,o,u<esc>|D:%s/{a,<C-r>"}/{<C-r>",a}/g

According to meta, vim answers can use plugins with no byte penalty. This is not a vim answer, but a vim + abolish answer.

Abolish is an extremely useful plugin. This section of the README nicely describes how this command (the Subvert command) works.

CJam, 29 19 bytes
q"aeioua"_eu+_1m<er

Try it online!
-10 bytes thanks to @Peter Taylor
Explanation:
q                       # take all input
 "aeioua"               # push vowel pairs
         _eu            # duplicate, uppercase
            +_          # concatenate, duplicate again
              1m<       # rotate left by 1
                 er     # transliterate

Although the question isn't specific about the input, I think you should probably use q rather than l to take input. The first test case appears to be multi-line. Also you can shorten "eioua" to _1m<. In fact, you can go further and golf this to q"aeioua"_eu+_1m<er

Retina 0.8.2, 20 bytes
T`_o`A\EI\OUAaei\oua

Try it online! Link includes test cases.

APL+WIN, 55 bytes
Prompts for input string:
i←(10≥n←'AEIOUaeiou'⍳s)/⍳⍴s←⎕⋄s[i]←'EIOUAeioua'[n~11]⋄s

AutoHotkey, 24 bytes
AuotHotkey automatically replaces letters in a case sensitive manner.
a::e
e::i
i::o
o::u
u::a

Vyxal, 9 bytes
k∨:½ƛǓ;∑Ŀ

Try it Online!
Basic transliteration.

Vyxal, 6 bytes
kv*kV*

Try it Online!
  *    # Ring translate by
kv     # Lowercase vowels
     * # Ring translate by
   kV  # Uppercase vowels

K (ngn/k), 25 bytes
{y^'x[<x]x?y}"UAEIOuaeio"

Try it online!

PHP, 38 bytes
Quite simple, not very creative, uses strtr to replace the vowels:
<?=strtr($argn,aeiouAEIOU,eiouaEIOUA);

Run with echo '<input>' | php -nF <filename> or Try it online.

Does this not assume that the input is assigned to the predefined variable argn? If so then that's not valid; you'd need to pass the string as an argument and use $argv1] instead.

@Shaggy No, if you run it with the -F flag, then it works with input on the command line. From the PHP docs on options: -F --process-file PHP file to execute for every input line. Added in PHP 5. The Try it online variable defining is just because some people don't have PHP installed locally, and I couldn't get the -F flag working in TIO.

Thanks, @David - that's my "something new" for PHP today :)

PHP, 90 Bytes
Try it online
Code
function f($s){echo strtr($s,array_combine(str_split(UuAaEeIiOo),str_split(AaEeIiOoUu)));}

Explanation
function f($s){
 echo strtr(
       $s,                          #The string to operate
       array_combine(               #combining arrays
            str_split(UuAaEeIiOo),  #splitting this strings
            str_split(AaEeIiOoUu))
              # With array combine php creates an array like
              # ["U"=>"A", "a"=>"e"....and so on]
              # strtr can replace strings in a string, using an array with
              # the values to replace and with what replace each value.
 );
}

75 Bytes if ran with php -r using $argv
<?=strtr($argv,array_combine(str_split(UuAaEeIiOo),str_split(AaEeIiOoUu)));

J, 33 bytes
rplc'aeiou',&((;"0)1&|.)'AEIOU'"1

Try it online!

str, 18 bytes
[aeiouaAEIOUA]#D#U

Try it online!
Explanation
                       implicit: over each character of the input:
[aeiouaAEIOUA]#D#U
[            ]         push this string
              #D       set this to the operation domain
                #U     set the charcter to the next character in the domain

q/kdb+, 36 33 bytes
Solution:
{(v,2#x)1+(v:"aeiouaAEIOUA")?x}@'

Examples:
q){(v,2#x)1+(v:"aeiouaAEIOUA")?x}@'"AEIOUaeiou"
"EIOUAeioua
q){(v,2#x)1+(v:"aeiouaAEIOUA")?x}@'"Programming Puzzles And Code Golf"
"Prugremmong Pazzlis End Cudi Gulf"

Explanation:
Figure out index of vowels, add one to push along to the next and index in. Still think this approach can be significantly improved...
{(v,2#x)1+(v:"aeiouaAEIOUA")?x}@' / the solution
{                             }@' / apply lambda to each character of input
                            ?x    / look up x in...
          (                )      / do together
             "aeiouaAEIOUA"       / lookup list
           v:                     / save as v
        1+                        / add one
 (     )                          / do together
    2#x                           / take 2 copies of x
  v,                              / prepend v

Bonus:
My old **36 byte(()) solution which I think is quite cool, but need to golf down the lists to make it competetive:
ssr/[;"uoiea%UOIEA%";"%uoiea%UOIEA"]

Charcoal, 35 bytes
ＵＴ≔AUOIEAauoieaσＦ¹¹⊞υ➙§σ⊕ι§σι▷SR⟦Ｓυ

Try it online!
Naive method.
Explanation:
ＵＴ                                         Set trim option to on, so output won't be a rectangle
    ≔AUOIEAauoieaσ                          Assign "AUIOEAauioea" to s
                   Ｆ¹¹                      For i (ι) from 0 to 10
                       ⊞υ                   Push to u (initially empty list)
                          ➙                 Rule of:
                            §σ⊕ι            S[i + 1]
                                 §σι         to S[i]. This is so a->A gets overwriteen by a->e
                                    ▷SR⟦Ｓυ  Replace input as string using u (now a list of rules)

PHP, 76 bytes.
$s=strtr($s,array_combine(str_split("aeiouAEIOU"),str_split("eiouaEIOUA")));

Check it out!
This was the shortest I was able to do this in PHP.
$s = //overwrite $s variable ($s should be a defined string or input)
    strtr(  //strtr replaces key => value pairs from arrays in a string
        $s, //the string we are converting
        array_combine( //create an array with key value pairs, key should be original vowel letter and value should be it's replacement
            str_split("aeiouAEIOU") //turn vowels (lower and upper) into an array
            ,str_split("eiouaEIOUA") //turn vowel replacements into an array
        )
    );

MATL, 15 bytes
,@11+Y2t1_YSXE]

Try it on MATL Online

Tcl, 56 bytes
proc C s {string map [split aeeiioouuaAEEIIOOUUA ""] $s}

Try it online!

APL (Dyalog Classic), 54 50 bytes
{(X,⍨1⌽v)[X⍳⍨v,X←(⍵,⍨1⌽w)[⍵⍳⍨⍵,⍨w←819⌶v←'AEIOU']]}

Try it online!

Very good test case generation!

I should've done "aeiouAEIOUbcd!?" or something, but thanks!

It’s a much more satisfying sentence, tho.

Or at least have added a small a.

Well, “worlda” sounds odd, but “wurlde” sounds very olde English.

Python 3:  148 126  121 Bytes
Fixed code, saved 22 bytes by not using a flag for case management
Saved 5 bytes by removing uneeded spaces
import re;print(re.sub('a|A',r"e",re.sub('e|E',r"i",re.sub('i|I',r"o",re.sub('o|O',r"u",re.sub('u|U',r"a",input()))))))

Definitely can be improved if i can figure out how to group patters with their respective groups of replaces. Will probaly save 90+ bytes

sed, 24 bytes
y/aeiouAEIOU/eiouaEIOUA/

GolfScript, 34 bytes
{.'aeiouAEIOU'?"eiouaEIOUA0"=\or}%
Where 0 denotes a null byte. In the TIO link, I had to use \0, so it is one byte longer.
Try it online!
Simple transliteration. I tried to build the two strings but it was 15 bytes longer.

Knight, 85 bytes
;=xP Wx;=v"aeiouAEIOU";=iF;W&v!?AxAv;=i+1i=vSvF1"";O+|G"eiouaEIOUA"iT A Ax"\"=xSxF1""

Try it online!