text:
!I!n!s!e!r!t! !i!n!b!e!t!w!e!e!n!
Posted from here.
This challenge is highly "distilled" from this question. Special thanks to @Akababa!
In this task, you should insert an exclamation mark at the start of the string and after every character.
Rules

There will always be a non-empty-string input. The input will not contain tabs either. You can assume that the input only contain non-extended ASCII printable characters and newlines.
The input will not contain trailing newlines as long as your language can't detect a newline.
This is a code-golf contest; the shortest answer should win.

Examples

4 newlines result in 5 newline-delimited exclamation marks. It is very hard to put this as a Markdown text, so this is stated instead.

1 2 3 4 5 6
129591 129012 129127 129582

0

Outputs

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

asd afjoK ak:e
kPrLd
    fOJOE;
    KFO
KFkepjgop sgpaoj   faj

Outputs

!a!s!d! !a!f!j!o!K! !a!k!:!e!
!k!P!r!L!d!
! ! ! ! !f!O!J!O!E!;!
! ! ! ! !K!F!O!
!K!F!k!e!p!j!g!o!p! !s!g!p!a!o!j! ! ! !f!a!j!

A base test case with only one character:

a

Outputs

!a!

(Auto-completion! Just kidding, there is no such thing.) Contains exclamation marks:

!!
!!
!!
!!
!!

Outputs:

!!!!!
!!!!!
!!!!!
!!!!!
!!!!!

very similar question

I didn't encounter this in the Sandbox though. (Also, that question takes one line of input.)

Downvoting without stating the reason is not a good idea. "The purpose of the policy is that I shouldn't be able to reuse the same answer to multiple questions."

I really don't understand the downvote - this is a clear and well written challenge. Re: being a duplicate - it's not (preceding '!' makes for a big difference), and I don't believe anyone has suggested so (no close votes).

if a language can't tell the difference between a\n and a, can we require that there are no trailing newlines?

I think so, as long as your statement is true.

Downvotes are inserted between every upvote, just like what the challege describes.

Is the case of a single space input " ", is the output supposed to be "!" or "! !"

@Kai The output is supposed to be ! !.

Is the input supposed to be only a string or could it be an array of characters?

@IsmaelMiguel generally, they're considered equivalent

This has 42 votes. Is this the meaning of life?

QuadR, 1 byte
Thanks to A__ for halving the byte count!
!

Try it online!
Replaces nothing with !

Python 3, 26 bytes
lambda s:s.replace('','!')

Try it online!

Welcome to the site!

Retina 0.8.2, 2 bytes

!

Try it online! At last, a challenge where Retina has a built-in!

Actually, I created this challenge based on this Retina built-in.

Works in QuadR too.

-1 bytes in QuadR.

@A__ Right, I forgot about that feature (If there is only one non-function line…). You may want to re-consider your check-mark.

Python 3, 27 bytes
lambda s:f"!{'!'.join(s)}!"

Try it online!
Honestly, I hope someone can show me a cool way to do this with a smaller byte count.

This doesnt handle the empty line case correctly

@flakes What do you mean? If you mean an empty string: we do not need to handle an empty string (and regardless this outputs !! in that case, which is what makes sense to me). If you mean the string \n: it does, since the correct output is !\n!.

@JAD As far as I can see, it doesn't have an empty string in the examples. Not only that, but the first rule literally states "there will always be a non-empty string input."

Ah I was incorrect. The first example has an empty line in the middle of the input. But this answer will handle placing the exclamation point in the middle of that, !\n!\n!. nice work.

https://codegolf.stackexchange.com/questions/190223/insert-nbetween/190386#190386 as you were saying to show a shorter way

Haskell, 18 bytes
('!':).(>>=(:"!"))

-1 byte thanks to @nimi
Try it online!

('!':). saves a byte.

Python 2, 27 bytes
lambda s:'!%s!'%'!'.join(s)

Try it online!

brainfuck, 24 22 bytes
-2 bytes thanks to JoKing.
-[-[-<]>>+<],[>.<.,]>.

Try it online!

damn, that's badass

JavaScript (ES6), 19 bytes
Takes input as an array of characters.
s=>`!${s.join`!`}!`

Try it online!

JavaScript (ES6),  23  20 bytes
Saved 3 bytes thanks to @ShieruAsakoto
Takes input as a string.
s=>[,...s,,].join`!`

Try it online!

JavaScript (ES6), 22 bytes
Suggested by @tjjfvi
Takes input as a string.
s=>s.replace(/|/g,"!")

Try it online!

Alternative with .replace, 22 bytes

@tjjfvi Nifty one!

I've got a 20 for your 23: s=>[,...s,,].join`!`

Labyrinth,  19 11 10  9 bytes
33
..
",@

Try it online!
How?
We enter the Labyrinth at the top-left facing right with an infinite stack of zeros...
                         I / O    stack
                                  0,0,0,...
3 - pop * 10 + 3                  3,0,0,0,...
  - 2 neighbours, forward
3 - pop * 10 + 3                  33,0,0,0,...
  - 2 neighbours, forward
. - pop & print chr          !    0,0,0,...
  - T junction from the side
  -   TOS==0, forward
, - read chr or -1       L        76,0,0,0,...   or   -1,0,0,0
  - T junction from the base
  -   if TOS > 0 right:
" -     no-op                     76,0,0,0,...
  -     2 neighbours, forward
. -     pop & print chr      L    0,0,0,...
  -     T junction from the side
  -       TOS==0, forward
3 -       ...back to the start
  -   elif TOS == -1 left:
@ -     exit                                          we're out!

  * right, but on the first occasion (from above) we hit the wall and turn
    around, so that's like a left

Luckily we don't need to handle un-printables, otherwise the first zero-byte would turn us around at , and play havoc.

Pepe, 47 bytes
REREEeRErEErREeeEeeeeEREEeeREEeereeREEEEeeEReee

Try it online!
Explanation:
REREEeRE # Push 0,then input (str),then 0 -> (R)
         # The zeroes are pushed to correct the inserting
rEE # Begin loop labelled 0 -> (r)
  rREeeEeeeeE # Push "!" -> (R)
              # r flag inserts it instead of pushing
  REEeeREEee # Move pointer pos 2 steps forward -> (R)
ree # Loop while (R) != 0
REEEEeeE # Remove characters of (R) that are in stack of (r)
         # Removes the 0 in (R)
Reee # Output (R)

How do you write this code? Is there some code converter that you use? This seems crazy to try and write

@Cruncher 1) I use this as my guide. 2) Nope, I don't use a code converter, I just use the guide to write the code.

R, 25 bytes
function(x)gsub("","!",x)

Try it online!
A function accepting and returning a character vector.

Can shave 3 bytes by switching the function form to scan(,''), like so https://tio.run/##K/r/P724NElDSUlHSVFJpzg5MU9DR11dU/O/kkdqTk6@Qnl@UU6KotJ/AA

@Sumner18 thanks. I started with that but it splits input at spaces.

@Sumner18 The challenge asks to handle input with newlines, which can't be done with scan (but which Nick's solution does handle, at least if you display the output with cat.)

8086 machine code, .COM format (MS-DOS 2+), 32 bytes
(-1 depending on emulator: see below)
For best results redirect standard input from a file, as typing gives odd-looking output due to no buffering; also, newlines look a little weird because they are stored as CR LF, and the CR part messes up the output.
This program behaves fine in an actual MS-DOS emulation (e.g. PCjs) but DOSBox seemed to have issues with Ctrl+Z EOF (see comments in the assembly listing), so DON'T try to enter input using the console in DOSBox unless you add the extra check!
BB 01 00 53 59 BA 0B 01 B4 40 CD 21 4A 4B B4 3F CD 21 85 C0 74 09 B4 40 43 41 CD 21 49 EB EE C3

Some interesting bits:

I saved some data space by reusing memory that had already been executed (the 21H in INT 21H happens to be !)

I was almost able to use an interesting trick that I found on the page "The Hidden Power of BCD Instructions" which would have allowed me to use AAA instead of a standard TEST to compare AL to 0, saving one byte. Unfortunately, this is not fully documented so I couldn't rely on it: for example, PCjs doesn't adjust anything but the carry and auxiliary carry flags. :-(

Assembly code (TASM ideal mode):
IDEAL
MODEL   TINY

CODESEG
ORG 100H

;; DOSBox (tested with 0.74-2) didn't seem to handle Ctrl-Z as EOF
;; so uncomment the ";;" lines to run it there.
MAIN:
    MOV     BX,1
    PUSH    BX
    POP     CX
    MOV     DX,OFFSET MAIN_1+1  ; The 21H in INT 21H
    MOV     AH,40H
MAIN_1:
    INT     21H
    DEC     DX
    ;;PUSH  DX
    ;;POP   SI
IO_LOOP:
    DEC     BX
    MOV     AH,3FH
    INT     21H
    ;;; This should work on an non-emulated PC.
    ;;;AAA      ; AL=0?
    TEST    AX,AX
    JZ      DONE
    ;;CMP   [BYTE PTR SI],1AH
    ;;JZ    DONE
    MOV     AH,40H
    INC     BX
    INC     CX
    INT     21H
    DEC     CX
    JMP     IO_LOOP
DONE:
    RET
ENDS
END MAIN

sed, 12 bytes
s/\b\|\B/!/g

Try it online!
-3 bytes thanks to Cows Quack

Actually the Sed code is just 15 characters there: Try it online!.

Great, thank you.  I was unclear how that worked...

s/\b\|\B/!/g also works for 12 bytes

@Cowsquack thank you.  updated.

6502, 12 bytes (13 bytes if Apple II)
6502
The machine code assumes that a pair of zero page locations are connected to character input ($FE) and output (FF) hardware. Many 6502-based systems facilitate I/O in this fashion, albeit I/O address are usually not in zero page.
For simplicity, I used Py65, a 6502 microcomputer system simulator written in Python.
Here is a memory dump from Py65. You can load the following code anywhere in zero page such that it does not overlap $FE and $FF.
       PC  AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110010
.mem 0:b
0000:  a9  21  85  ff  a5  fe  f0  fc  85  ff  d0  f4

Running in a Windows command window, you can paste (Ctrl+V) any text you desire, or you can simply type. If typing, press Ctrl+J for a newline (same ASCII char). Press Ctrl+C to interrupt the processor and return to the Py65 command prompt.
Naturally, assembly code is easier to read.
       PC  AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110010
.d 00:0b
$0000  a9 21     LDA #$21
$0002  85 ff     STA $ff
$0004  a5 fe     LDA $fe
$0006  f0 fc     BEQ $0004
$0008  85 ff     STA $ff
$000a  d0 f4     BNE $0000

For clarity, here is the assembly code in CBA65 format.
; ASSEMBLE:
; cba65 bangit
;
; LOAD/RUN
; python3 py65/monitor.py -i 00fe -o 00ff -l bangit.bin
; goto 0000

        .FILES  BIN=256

; I/O LOCATIONS
GETC    .EQU    $FE             ; (1) MOVING PY65'S GETC TO ZP SHAVES 1 BYTE
PUTC    .EQU    $FF             ; (1) MOVING PY65'S PUTC TO ZP SHAVES 2 BYTES

        .ORG    $0000

VROOM   LDA     #'!'
        STA     PUTC
VROOM2  LDA     GETC
        BEQ     VROOM2
        STA     PUTC
        BNE     VROOM

        .END

Apple II
The code above assumes a null indicates there is no input, so continues polling until a non-null value is returned.
For comparison, the Apple I and Apple II signals availability of a new character by setting bit 7 of the keyboard I/O address, which then needs to be cleared after fetching the character. On those systems, character I/O usually is performed by calling system monitor routines instead of accessing the hardware directly.
By calling RDKEY ($FD0C) and COUT ($FDED), the Apple II equivalent of the above can be coded in 13 bytes, and is runnable anywhere in RAM. Here is the code I ran in an Apple //e emulator, a2ix on Android 9.
Pressing Return has the same effect as a newline.
*300L

0300-   A9 A1       LDA   #$A1
0302-   20 ED FD    JSR   $FDED
0305-   20 0C FD    JSR   $FD0C
0308-   20 ED FD    JSR   $FDED
030B-   F0 F3       BEQ   $0300

Did you notice that instead of the normal ASCII value #$21 for the exclamation point, #$A1 is used instead? That's because sending standard ASCII values to COUT causes them to be displayed in "inverse mode," black on white. Displaying ASCII in normal white on black requires adding #$80 to the character value in the accumulator before calling COUT. Because RDKEY returns characters with the hi-bit set, assembly programs generally cleared the bit of the character to obtain its ASCII value before using it.

Welcome to the site! :)

Thank you, @Rahul!

Jelly, 5 bytes
Ż”!ṁż

A full program accepting a string, which prints the result.
Try it online!
How?
Ż”!ṁż - Main Link: list of characters, s   e.g. "abc"
 ”!   - character '!'                           '!'
   ṁ  - mould like:
Ż     -   s with a zero prepended              "!!!!"
    ż - zip together with s                    ["!a","!b","!c",'!']
      - implicit (smashing) print              !a!b!c!

Befunge-98 (PyFunge), 7 bytes
'!,#@~,

Try it online!

MarioLANG, 95 94 90 89 69 bytes
++++++
======< >)
>+++++++",+[
=======<.==<
>+++++++!(.-
========#===

Try it online!
First time trying out MarioLANG, that was a lot of fun!
Thanks to Jo King for -20 bytes
Explanation:
So, as the name implies, MarioLANG is made to execute like a game of Super Mario Bros. It operates similarly to BF, with memory arranged in a tape of cells. There are operators to increment, decrement, print (as ascii or numeric) and read into the current memory cell, and operators to move left or right along the tape.
Mario (the instruction pointer) always begins in the top left cell of the program, with his intended direction of motion set to the right. If Mario does not have a floor-like object beneath him (=, ", or #), he will fall until he reaches a floor-like object. If Mario leaves the program space, the program ends due to Game Over :(
This specific program can basically be split into two halves: the setup, and the loop.
   Setup                          Loop
-----------------------------------------------
                       |
++++++                 |
======<                |          >)
>+++++++               |          ",+[
=======<               |          .==<
>+++++++               |          !(.-
========               |          #===

In the Setup section, we're simply incrementing the first memory cell until we reach 33 - the ASCII value for "!". Easy enough; if this can be golfed, it's purely a matter of shape. Mario starts from the top left, picks up 10 coins, starts falling when picking up the 11th, switches directions, then repeats. He picks up the last 11 coins without switching directions; he ends the setup section at the bottom-rightmost "+".
In the loop section, Mario starts by reaching an elevator. The "!" operator makes him cease motion, so that he remains on the elevator. On the way up, it prints the corresponding ASCII character to the current memory cell's value (this one is always 33, "!"), then switches to the next cell in memory. Mario reaches the top and sets his direction to the right. He falls, and reads a character from input as its ASCII value (or -1 if no character). We increment because the only measure of control in MarioLANG is to skip an instruction if the current memory cell has a value of 0. If it does, we skip changing Mario's direction, so he will walk right off of the next floor to his doom. If it does not, we set direction to left; walking left off of the floor below decrements the current cell back to its previous value, that value is printed, and we move back to the first memory cell before getting back on the elevator.

Previous version (89 bytes):
+++++++++++>,
==========@"+
+++++++++++)[
@==========.==<
+++++++++++!(.-
===========#===

62 bytes by using a multiplication loop instead of just a counter

Okay now THAT is cool. I'll update as soon as I have time to redo the explanation, thanks a bunch!

Aha! 60 bytes by multiplying 56 + 3 instead of 84+1

Man, I know it isn't exactly your first rodeo, but this is really impressive. xD

Actually, this is my first time golfing MarioLANG. I just have some experience with brainfuck as well as other 2D languages

Zsh, 32 23 bytes
<<<!${(j:!:)${(s::)1}}!

Try it online!

Try it online!
(s::) splits into characters, (j:!:) joins on !s.

Perl 5 -p0, 17 6 bytes
s,,!,g

Try it online!
My original answer was -p and $_='!'.s,.,$&!,gr. Thanks to @Nahuel Fouilleul for cutting 11 bytes and to @Grimy for the -p0 tip.

6 bytes

@NahuelFouilleul -lp gives incorrect output for the \n\n\n\n test case (returns 4 newline-separated ! instead of the specified 5). -p0 works correctly.

Perl 6, 16 11 bytes
{S:g/<(/!/}

Try it online!
Replaces all zero width matches with exclamation marks. Null regexes are not allowed, so we use a capture marker to capture nothing instead

AWK, 11 bytes
gsub(a,"!")

Try it online!
This is similar to some other entries.  It changes a null string to ! globally, using $0 as the default target, then prints the result since no other action is defined.  Using a works since it's an undefined variable and is shorter than using "" (which would do the same thing).

APL (Dyalog Unicode), 11 bytes
(∊⊢⍪⍪¨)∘'!'

Try it online!
@Adám's golf to mine (see below).
{'!'⍪∊⍉↑⍵('!'⍴⍨≢⍵)}  ⍝ original
{'!'⍪∊⍵⍪¨('!'⍴⍨≢⍵)}  ⍝ concatenate each instead of transpose mix
{'!'⍪∊⍵⍪¨ '!'}       ⍝ each already handles many-to-one
{ ⍵ ⍪∊⍺⍪¨  ⍵ }∘'!'   ⍝ break out "!"
{∊⍵ ⍪ ⍺⍪¨  ⍵ }∘'!'   ⍝ defer flattening to later
(∊⊢ ⍪  ⍪¨    )∘'!'   ⍝ go tacit
(∊⊢⍪⍪¨)∘'!'          ⍝ remove spacing

APL (Dyalog Unicode), 19 bytes
{'!'⍪∊⍉↑⍵('!'⍴⍨≢⍵)}

Try it online!
My first APL submission :P Loving this language. No idea why I need the parentheses after ⍵.
{'!'⍪∊⍉↑⍵('!'⍴⍨≢⍵)}
{                   } ⍝ Boilerplate
              ⍴⍨      ⍝ Repeat
           '!'        ⍝ Exclamation point
                 ≢⍵  ⍝ len(input) times
         ⍵(        )  ⍝ Wrap ^ into an array with the input
       ↑              ⍝ Matrixify
      ⍉               ⍝ Transpose
     ∊                ⍝ Flatten
    ⍪                  ⍝ Prepend
 '!'                  ⍝ An exclamation point

Congrats on your first APL answer! I'm quite impressed, considering how new you are to APL. With experience, you will be able to golf this to '!'∘(∊,¨,⊣)

@Adám thanks! This is just the culmination of a few hours practice, I was sure it could be golfed :D

@Adám what does that exactly do? seems like a bunch of compositions?

Let's continue this discussion in chat…

@Hippopotomonstrosesquipedalian : that code I counted 19 UTF-8 characters, but 37 bytes. Please illustrate exactly where your 19 bytes came from. If you whatever-unicode code page could map 19 UTF-8 code points to just 19 bytes, i wanna see the mapping of it. Don't try selling me transparent silk.

@RAREKpopManifesto based on the Dyalog APL codepage the bytes would be 185 173 59 208 208 128 248 184 13 204 13 (thi is for the shorter of the 2 answers).

I've locked the comments under this answer for a day, as this has gone beyond both polite discussion and the intended use of comments. Please think carefully about if your comment actually improves the answer before posting, once the lock is lifted

Ruby, 17 16 bytes
->s{s.gsub'',?!}

Try it online!
Thanks Value Ink for -1 byte

Remove the space after gsub.

SimpleTemplate, 23 bytes
This is a language I wrote, and it was supposed to be for templates, but well.
!{@eachargv.0}{@echo_}!

Should be almost self-explanatory, once you see the ungolfed code:
!{@each argv.0 as char} {@echo char}!{@/}

And an explanation:

! - Prints the literal ! character
{@each argv.0 as char} - Loops through every character, with the value set to the variable char (optional, the default variable is _).
argv.0 is the first parameter passed to the render() method of the compiler.
{@echo char}! - outputs the char variable and a literal ! character.
For the golfed version, the default variable _ is used instead.
{@/} - closes the loop (optional)

Pure SimpleTemplate solution:
{@fn x}!{@eachargv.0}{@echo_}!{@/}{@/}

Creates a function x that outputs the same result.
You can use it like this:
{@call x "this is an example"}

You can try all of this on: http://sandbox.onlinephpfunctions.com/code/f6baff8d411fc8227ece81eccf05b6e7d3586bfa
On the line 908, you can use the variables $golfed, $ungolfed and $fn to test all the versions.

However, if it is allowed to use a character array, the code is simplified (20 bytes):
!{@echoj"!" argv.0}!

And ungolfed:
!{@echo separator "!" argv.0}!

Basically, outputs all items in the array, joined by "!", surrounded by literal !.
Due to limitations in the compiler class, the space is mandatory (in the golfed version).
This code is also extremelly harder to use in pure SimpleTemplate (using the function as example):
{@fn x}!{@echoj"!" argv.0}!{@/}

{@// alternative: @call str_split into a "a char array"}
{@set a "a", " ", "c", "h", "a", "r", " ", "a", "r", "r", "a", "y"}

{@call x a}

The @call can call a function that exists in PHP, which means that it isn't a pure SimpleTemplate solution.

Bash, 36 bytes
while read -n1 c;do printf \!$c;done

Try it online!
This counts on the newline terminating the input for the last ! mark.

Welcome! Please consider adding an explanation or link to an interpreter or something, because code-only answers are automatically flagged as low-quality.

@mbomb007, thanks for the pointer.

Unfortunately this does not add an ! at the end of the input.

@Cowsquack: on my terminal, the newline that terminates the input gets the ! added. On tio.run, the input needs to be terminated with a carriage return. I've updated the link to the Try it Online to reflect that.

VBA, 75 bytes 72 bytes
72 bytes as a sub that outputs to the immediate window (thanks @taylorscott)
Sub s(x):Debug.?"!";:For i=1To Len(x):Debug.?Mid(x,i,1)"!";:Next:End Sub

75 bytes as a function that returns the formatted string.
Function t(x):t="!":For i=1To Len(x):t=t &Mid(x,i,1) &"!":Next:End Function

Which expands to and is readable as
Public Function t(x)
    t = "!"
    For i = 1 To Len(x)
        t = t & Mid(x, i, 1) & "!"
    Next
End Function

Test cases
Public Sub test_golf()

    x = "1 2 3 4 5 6" & vbCr & "129591 129012 129127 129582" & vbCr & vbCr & "0"
    'x = "a"
    'x = "!!" & vbCr & "!!" & vbCr & "!!" & vbCr & "!!" & vbCr & "!!"

    Debug.Print x
    s(x)              ' to call the sub
    Debug.Print t(x)  ' to call the function

End Sub

You can get this down to a 48 byte immediate window function as ?"!";:For i=1To[Len(A1)]:?Mid([A1],i,1)"!";:Next

@TaylorScott, I agree that would work in Excel VBA.  I was just thinking of a pure VBA solution.

If you want to keep it as a pure VBA function, you can still get it down a bit by switching it to a sub and printing directly to the console as Sub t(x):Debug.?"!";:For i=1To Len(x):Debug.?Mid(x,i,1)"!";:Next:End Sub or Sub t(x):s="!":For i=1To Len(x):s=s+Mid(x,i,1)+"!":Next:Debug.?s:End Sub

Wolfram Language (Mathematica), 26 16 bytes
"!"<>#&/@#<>"!"&

Try it online!
Input a list of characters. Returns a string.

it does not produce the result in a string format tho

Triangular, 15 13 bytes
B\3;#*~.,</@<

Try it online!
-2 bytes after remembering that Triangular has a conditional halt operator.
I believe this is as short as it gets on this one. Triangular does have conditional direction-change operators, but they unfortunately work differently than the other conditionals. While all others check if ToS <= 0, the direction-changing conditionals check ToS != 0. If this weren't the case, we would have 10 bytes in the form of Bq3~#*/@<<.
Ungolfed:
    B
   \ 3
  ; # *
 ~ . , <
/ @ <
----------------------------------------------------
B3*              - Push 11 and 3, then pop both and push their product.
    <,<          - Change directions 3 times (to save 2 bytes on last line)
        @/       - Print Top of Stack value as a character, do not pop
          ~;\    - Push a character from input to ToS. Halt if ToS <= 0. Change Direction.
              #  - Print ToS as a character and pop

Previous Version (15 bytes):
B.3\.*#).(/?~@<

C# (Visual C# Interactive Compiler), 28 bytes
s=>$"!{String.Join("!",s)}!"

Try it online!

nice use of interpolated strings, wouldn't have thought of that

Java 8, 20 bytes
A lambda function from String to String.
s->s.replace("","!")

Try It Online

05AB1E, 4 bytes
€'!Ć

I/O as a list of characters.
Try it online.
Explanation:
€'!  '# Prepend a "!"-item before each character in the (implicit) input-list
   Ć  # Enclose (append the first character of the list at the end of it)
      # (after which the result is output implicitly)

><>, 11 6 bytes
"!"oio

Try it online!
Saved 5 bytes thanks to Jo King, suggesting exiting with an error. Previous version which does not exit with an error:
"!"oi:0(?;o

Try it online!

You can remove the :0(?; to terminate in an error

Kotlin, 50 bytes
fun f(s:String)=s.map{"!$it"}.joinToString("")+"!"

Try it online!
This is my first participation on this site, thought I would try a challenge with my new favourite language.

29 bytes with replace and a lambda

MAWP, 18 bytes
%|092M3W!;~[;~!;~]

Dion's solution.
Try it!
Older solution(19 bytes):
%|0~[65W3M;;]65W3M;

Try it!

18 bytes https://8dion8.github.io/MAWP/?code=%25%7C092M3W!%3B~%5B%3B~!%3B~%5D&input=Hello%20there

Wow, lotta work for a byte.

Thats codegolf for ya :D

Argh! So close! Pushing a ! character in 1+ is already 11 bytes anyway...

Hexagony, 11 bytes
$>P...@1;,<

Try it online!
  $ > P
 . . . @
1 ; , < .
 . . . .
  . . .

P1 in place of 33 so that it resets the memory.
MP is stationary

(old) Hexagony, 17 bytes
{33...@;",<./{;/>

Try it online!
  { 3 3
 . . . @
; " , < .
 / { ; /
  > . .

{33 Puts an ! in left memory
;" Prints ! at the start and sets back mem
, Gets the next byte of input, < sends the IP U-R if null (which terminates it with @), D-R else
/{;/ Reflects IP, prints current byte, and sets it to the next line
> Redirects the IP to the start of the loop

Vyxal, 4 bytes
¤\!V

 ¤\!V - Full program
-------
 ¤    - Push empty string to the stack
  \!  - Push exclamation mark to the stack, better than `!`
    V - take implicit input and replace the empty
        string with the exclamation point

For an empty input, it will produce !0! because it considers the empty input 0, but I don't believe this can be fixed since taking input plainly returns 0 for "".
Try it Online!

Whitespace, 79 bytes
[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_input][S N
S _Duplicate_input][S S S T S S T   N
_Push_9_tab][T  S S T   _Subtract][N
T   S S N
_If_0_jump_to_Label_END][S S S T    S S S S T   N
_Push_33_!][T   N
S S _Print_as_character][T  N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_END][S S S T  S S S S T   N
_Push_33_!][T   N
S S _Print_as_character]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Since Whitespace inputs one character at a time, the input should contain a trailing tab (\t) so it knows when to stop reading characters and the input is done.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Start LOOP:
  Character c = STDIN as character
  If(c == '\t'):
    Call function END
  Print '!'
  Print c
  Go to next iteration of loop

function END:
  print '!'

MathGolf, 6 bytes
É'!\'!

Try it online!
Explanation
Nothing fancy here, just a loop
É        for each character do the next 3 operations
 '!      push single character "!"
   \     swap top elements
    '!   push single character "!"

PHP (7.4), 31 bytes
Based on Petah's comment.
fn($s)=>preg_replace(__,'!',$s)

Try it online!

PHP, 52 bytes
function($s){return'!'.join('!',str_split($s)).'!';}

Try it online!

PHP 7.4 fn($s)=>preg_replace('//', '!', $s);

PHP, 75 bytes
Full program.
foreach(file('php://stdin')as$e)echo'!'.implode("!",str_split($e));echo"!";

Try it online!
PHP, 100 bytes
foreach(explode("\n",file_get_contents('php://stdin'))as$e)echo'!'.implode("!",str_split($e))."!\n";

Try it online!
PHP, 117 bytes
foreach(explode("\n",file_get_contents('php://stdin'))as$e){echo'!';foreach(str_split($e)as$c)echo $c."!";echo "\n";}

Try it online!

Instead of echo'!'.implode("!",str_split($e));echo"!";, you can do echo'!',join("!",str_split($e)),"!";, which should save 7 bytes (read about join() on https://www.php.net/manual/en/function.join.php). According to https://www.php.net/manual/en/features.commandline.io-streams.php you can just use the constant STDIN (I don't know how if will work).

I did that intentionally , for saving bytes i removed brackets and i want to echo "!" after the foreach loop.

Oh, yeah, you're right. I missed that. But if you are reading line by line, you should output the newlines as well, except for the last one. echo doesn't output newlines, so, everything should be in the same line. You can use echo'!',join('!',str_split(file_get_contents('php://stdin'))),'!';, which is only 66 bytes long (or less, if the constant STDIN works) and fixes that.

I mean, echo doesn't automatically outputs newlines at the end, so, if you read line by line, you have to output the newline, if it isn't in the input.

file() returns an array of strings , each string has a newline as last character . @IsmaelMiguel

Forth (gforth), 40 39 bytes
: f ." !"bounds do i 1 type ." !"loop ;

Try it online!
Code Explanation
: f           \ start a new word definition
  ." !"bounds \ print ! and place the ending address on the stack
  do          \ start a counted loop from start-addr to end-addr
    i         \ get address of current char
    1 type    \ print the char at the given address
    ." !"     \ print !
  loop        \ end the loop
;             \ end the word definition

Emacs Lisp, 41 bytes
(while(or(insert"!")(not(forward-char))))

Assuming input is received as the contents of the current buffer

C (gcc), 48 45 39 bytes
f(char*s){printf("!%.1s",s++)>1&&f(s);}

Try it online!
-3 thanks to ceilingcat

Python 3, 26 bytes
lambda x:x.replace('','!')

Try it online!

This exact answer has already been posted by Waterbyte

Keg, 9 8 bytes
?⑷\!⑸\!^

Using a mapping approach really does help
Try it online!
Answer History
9 bytes
?^(\!')\!

Pretty much a port of the MathGolf submission.
Try it online!

I think the explicit ? is not needed.

No. It isn't. Updated my answer

PowerShell, 21 bytes
"$args"-replace"","!"

Try it online!
Boring regex replacement is boring. ;-)

Brachylog, 10 bytes
"!"w.∋w?w⊥

Try it online!
Takes input through the output variable, and unifies the input variable with "!", printing the output.
"!"w          Print "!", which is the input variable.
    .∋w       Print an element of the output variable.
       ?w     Print the input variable again.
         ⊥    Fail.

Japt, 4 bytes
rP'!

Try it
Japt -P, 7 bytes
Unfortunately ! is a reserved character, necessitating the quotation marks.
ï'! i'!

Try it
Not much to explain: ï is Cartesian product and i prepends.

05AB1E, 6 bytes
-1 thanks to Kevin Cruijssen. Takes input as a list of characters.
õ.ø'!ý

Try it online! or  Try it online! (with input as a string)

Are you a bit rusty golfing in 05AB1E? ;p

@KevinCruijssen Perhaps (now that I think about it I kinda am) :(. But I never actually knew how to exploit € so I guess I'm fine.

Yeah, it's something new this version.. The regular map ε works the same as in the legacy, but the € keeps all values on the stack. So €D would duplicate each character for example, while still keeping a 1D list. Not sure who's idea that was (probably Adnan), but it's useful in some cases. :) In other cases it can be pretty annoying as well, though.

@KevinCruijssen Interesting, thanks for the info (ahem ahem I do see it's useful sometimes :P)

-1 byte for your approach: õ.ø'!ý (surrounding with an empty string before joining).

Ah, thanks, this version was just a direct port of my initial 8-byter which used string input, so this wouldn't have worked before... Thanks for the heads-up.

Gema, 11 characters
\A=\!
?=?\!

Unfortunately ! starts a comment in Gema, so must be escaped.
Sample run:
bash-5.0$ echo -ne '1 2 3 4 5 6\n129591 129012 129127 129582\n\n0' | gema '\A=\!;?=?\!'
!1! !2! !3! !4! !5! !6!
!1!2!9!5!9!1! !1!2!9!0!1!2! !1!2!9!1!2!7! !1!2!9!5!8!2!
!
!0!

Try it online!

Japt, 4 bytes
rP'!

Try it
r      Replace
 P     all empty strings "" with
  '!   An exclamation mark (If '!' wasn't a special character in Japt I could remove the quote)

You'd only be able to ditch the ' if the replacement were a number.

Perl 5 + -p, 11 bytes
s/^|.\K/!/g

Try it online!

Pyth, 8 bytes
+\!s+R\!

Try it online!

     Code | Explanation
----------+-------------------------------------
+\!s+R\!  | Code
+\!s+R\!Q | with implicit variables filled
----------+-------------------------------------
     R  Q | For each d in input, replace d with:
    +R\!  |  d+"!"
   s      | Join results on empty string
+\!       | Add "!" to beginning
          | Print (implicit)

C (gcc), 69 62 50 bytes
Saved 12 bytes, thanks to ErikF's suggestion:
f(char*s){for(printf("!");*s;)printf("%c!",*s++);}

Try it online!

You can use the passed-in pointer to iterate through the string and put the first printf in the for loop to save 12 bytes: Try it online!

Great idea! I'll update it

46 bytes

@ceilingcat that is a completely different method. Should be posted as its own answer.

J, 12 bytes
'!',,@,.&'!'

Try it online!

Aheui (esotope), 61 bytes
붖다따삭바사빠맣삭붛
밙봆＠뫃선차희져썬뻐

Try it online!
Nice small aheui code.

Scala, 17 bytes
_.replace("","!")

Try it online!
-3b thanks to Jo King!
Thanks to Dr Y Wit for linking me to the fact that not enforcing typing is allowed, and for the working TIO link.

ah, you're right; fixing this.

Something like this perhaps? I don't know Scala

oh? it looks like it compiles like this. Now I'm really sad we can't do _.replace("","!"). Nice one anyway :)

Actually, your answer does not fully comply with the rules because it's neither a program nor a function but rather just code snippet. However if you post a function literal s=>s.replace("","!") that would be shorter and more correct. Try it online!

Maybe even _.replace("","!") would be OK. See https://codegolf.stackexchange.com/questions/3885/tips-for-golfing-in-scala

@DrYWit Thanks; I'll let still the current TIO link though, because _.replace("","!") does not work there (I tried earlier before my comment 3h ago).

Well, if you declare function val with the type then you can bind a function literal _.replace("","!") to it. Check my TIO link.

You're right! Now I'll be able to post Scala lambdas easily. Thanks again!

Brain-Flak, 54 bytes
(()){({}<>)((((()()()()){}){}){}())<>}<>{({}<>)<>}<>{}

Try it online!
Code:
(())                            push 1, so the loop runs at least one time
{                               while stack 1 isn't empty
    ({}<>)                      move letter to stack 2
    ((((()()()()){}){}){}())    push 33 (Exclamation Mark) on stack 2
    <>                          return to stack 1 for checking if the end is reached
}
<>{({}<>)<>}                    move everything from stack 2 back to stack 1 (otherwise the text would be reversed)
<>{}                            switch to stack 1 and delete leading 1

Pushy, 9 bytes
L:33{;33"

Try it online!

L:   ;        \ len(input) times do:
  33          \    Append character 33 (exclamation mark)
    {         \    Cyclically shift the string left once
      33      \ Append character 33 again
        "     \ Print the result

Javascript (27 bytes)
My first code golf, 27 bytes in Javascript. Could probably shave some more bytes off, but I'm not too sure.
f={x:s=>`!${s.join('!')}!`}

Example Usage
console.log(f.x('1 2 3 4 5'.split('')))
// Output: !1! !2! !3! !4! !5!

Welcome to CCGC! Using the way of defining lambdas that has been kind of standardized on this site, this is 21 bytes: Try it online! (unless the lambda is called recursively, the f= does not need to be counted)

1+, 20 19 bytes
1##11"+""*"**+;,;1#

1+ 19 vs 18 MAWP
Error-terminating because comparison is expensive.

I think i'm winning for now ;) btw, mawp submissions should be here https://github.com/8Dion8/8Dion8.github.io/blob/master/scraper/posts.txt

@Dion Yeah, only 1 byte away! I'm creating the 1+ answer list now.

I created a python script to gather everything... Maybe you could change it a bit and use it for gathering 1+ answers? If you are interested, ill clean up the code so its understandable xd

@Dion Apparently your script searches for 1+ with the SE search tool but that will not work well for 1+. Manual 1+ answer list

https://github.com/8Dion8/8Dion8.github.io/blob/master/scraper/scraper.py is the current script

Cleaned up the code and added comments

@Dion Can you change the format to the format in my answer list (including scoreboard)

I can try, will take a bit of time though

K (ngn/k), 13 12 bytes
-1 byte from @ngn's savings
{x,/y,'x}"!"

Try it online!
Creates a function projection, with x fixed to "!".

y,'x pair-wise append an exclamation mark to each character in the input
x,/ flatten the list, using "!" as the seed (to prepend the leading "!")

save a byte by turning "!" into a curried argument: f:{x,/y,'x}"!"

AWK, 11 bytes
gsub(_,"!")

 echo '
1 2 3 4 5 6
129591 129012 129127 129582

0
asd afjoK ak:e
kPrLd
    fOJOE;
    KFO
KFkepjgop sgpaoj   faj
!!
!!
!!
!!
!!' | awk 'gsub(_,"!")'

!1! !2! !3! !4! !5! !6!
!1!2!9!5!9!1! !1!2!9!0!1!2! !1!2!9!1!2!7! !1!2!9!5!8!2!
!
!0!
!a!s!d! !a!f!j!o!K! !a!k!:!e!
!k!P!r!L!d!
! ! ! ! !f!O!J!O!E!;!
! ! ! ! !K!F!O!
!K!F!k!e!p!j!g!o!p! !s!g!p!a!o!j! ! ! !f!a!j!
!!!!!
!!!!!
!!!!!
!!!!!
!!!!!

It doesn’t work

i've cleaned up your answer formatting. In the future, please try to make it clear which part of your submission is your actual answer. (side note: this is almost identical to a previous answer)

@Hippopotomonstrosesquipedalian This seems to work fine, why do you think it doesn't?

@mousetail it works now, but it didn’t before with the word “awk” in front of it.

@Hippopotomonstrosesquipedalian Copy pasting the code before the edit in bash already gave the correct solution even before the edit

@mousetail I used TIO

@Hippopotomonstrosesquipedalian It works fine in TIO: https://tio.run/##TcqxDoIwGATg/X@Kg6WaONBqRXSWQUzwDcyPFEg7tLExLr57BScvl3w3XMdxSgnmMXkIklDYYgeNPUlV6UpippBqQapyQR8UUUEce/BgfQN2R0Pu9rz2hDlDe2nPp99s6paa2plgRx8Qx8DeLg@2lGX/FfiA3w5ijK9udd/kWb4WKX0B

Python, 30 Bytes
lambda x:'!%s!'%'!'.join([*x])

It feels like these methods were designed for the challenge!
-1 from Jacob (now noodle man) by using the cursed % (Dun dun dun!)
-3 from Glorfindel for using a starred method for conversion!
!T!r!y! !r!u!n!n!i!n!g! !i!t! !o!n!l!i!n!e!

Here's 33, I don't know much python so it can likely be golfed further

list(...) can always be [*...] instead

27 bytes - you don't even need to convert it to a list, since any iterable will work.

Rockstar, 67 bytes
listen to S
while S
cut S
join S with "!"
say "!"+S+"!"
listen to S

Try it here (Code will need to be pasted in)

Python 3, 29 Bytes
print('',*input(),'',sep="!")

Try It Online

C#, 142 bytes
public class P{public static void Main(string[]a){System.Console.Write("!");foreach(char c in a[0]){System.Console.Write(c.ToString()+"!");}}}

Charcoal, 6 bytes
⭆Ｓ⁺!ι!

Try it online! Link is to verbose version of code. Works on empty strings too. Input format is somewhat cumbersome due to Charcoal's lack of EOF. Works by preceding each character with a ! and then suffixing a final ! on the end. Alternative version, also 6 bytes:
⪫!!⪫Ｓ!

Try it online! Link is to verbose version of code. Works by joining the characters on ! and then wrapping them in !!.

SNOBOL4 (CSNOBOL4), 94 bytes
I	I =INPUT	:F(END)
S	I LEN(1) . X REM . I	:F(O)
	O ='!' O X	:(S)
O	OUTPUT =O '!'
	O =	:(I)
END

Try it online!
Prints with an additional trailing newline (as SNOBOL always prints a line break). The way input is consumed, there is no way of distinguishing between a final line ending in \n or not.

Stax, 6 5 bytes
_z'!R

Run and debug it
Replace "" with "!" using regex replacement.  I don't exactly understand why this works.
Edit: Found it in the Ecma spec: 15.5.4.10

If there is a match with an emptystring   (in   other   words,   if   the   value   of regexp.lastIndex is   left   unchanged),   increment regexp.lastIndex by 1.

Old Stuff:
I would have been able to get to 5 bytes in either of two scenarios.

If input was provided in an escaped literal e.g. "line1\nline2".  But I opted against that for the sake of "usability".
If there was not a bug feature in stax's zip implementation when encountering empty strings/arrays.

Wolfram Language (Mathematica), 49 48 42 bytes
#~StringSplit~""~StringRiffle~{a="!",a,a}&

Try it online!
-6 bytes thanks to @attinat

The code in the Header, Code, and Footer sections is run.
You can use infix notation and drop the { } in StringSplit for 42 bytes

@attinat Thanks that helps a lot!

Ahead, 12 bytes
~irj!'~
@Wu<

Try it online!

Lua, 31 bytes
print((io.read():gsub("","!")))

Elvish, 32 bytes
use re;re:replace "" "!" (slurp)
Copy and paste into the Live Environment to try it out!

Welcome to the site! Would it be possible to edit in a link to an online interpreter, such as Try it online! so that other users can verify your program?

@cairdcoinheringaahing I added a link to the provided live environment.

C (gcc), 32 bytes
f(s){printf("!%s",s)-1&&f(s+4);}

Try it online!

Red, 47 bytes
func[s][parse s[insert"!"any[skip insert"!"]]s]

Try it online!

Pip, 5 bytes
aJW'!

Try it online!
The JW builtin was made for challenges like this.

Zsh, 12 bytes
<<<${1///!}!

Try it online!

Branch, 11 bytes
33.,[.33.,]

Try it on the online Branch interpreter!
Put 33 on the tree and output (!). Then, grab input. Finally, while that value is not EOF, output it, output 33 (!), and grab input again.

Vim, 13 bytes
:%s/\_./!&/g

Works by putting a ! before every character, including newline characters. The TIO version doesn't work properly for the 4 newline testcase, but it does work in Vim.
Try it online!

Subleq (8-bit), 1211 bytes
-1 byte for removing last 0
2 -1 33
-1 8 -1
8 -1 0
8 8

Subleq emulator
Explanation
0:  2 -1 33 ' Output 2: (char(33)); 3rd argument is not used for output so use it for memory
3: -1  8 -1 ' Read input to 8:, exit if null
6:  8 -1  0 ' Output 8:
9:  8  8    ' 8: = 0 goto 0

BRASCA, 14 13 bytes
-1 byte thanks to RezNesX
,![$'!oo{]'!o

Try it online!
Explanation
,               - Reverse stack
 ![$    {]      - Loop stack length:
    '!oo        -     Print "!" followed by the next letter
          '!o   - Print the last "!"

13 bytes: ,![$'!oo{]'!o

Go, 105 bytes
import."regexp"
func f(s[]byte)[]byte{return append(MustCompile(`(?s).`).ReplaceAll(s,[]byte(`!$0`)),33)}

Attempt This Online!

Excel, 44 bytes
="!"&CONCAT(MID(A1,SEQUENCE(LEN(A1)),1)&"!")

"!" is just the first !.
CONCAT(MID(A1,SEQUENCE(LEN(A1)),1)&"!")

SEQUENCE(LEN(A1)) creates an array 1, 2, ... X where X is the length of the input.
MID(A1,SEQUENCE(~),1) pulls the nth character from the input.
MID(~)&"!" adds ! after every one of those characters.
CONCAT(MID(~)&"!") combines all those nth character + ! into one string.

Note: The line breaks are there with or without Word Wrap turned on but it won't look right until you turn it on. The screenshot has Word Wrap turned on.

Factor,  31  28 bytes
[ 33 interleaved [I !${}!I]]

Attempt This Online!

33 interleaved Insert an exclamation point between each character of the input.

[I !${}!I] Interpolate the above string into the ${}, adding exclamation points to the beginning and end, and print.

BQN, 11 bytes
'!'⊸(⊣∾´∾¨)

Anonymous tacit function that takes and returns a string. Try it at BQN online!
Explanation
'!'⊸(⊣∾´∾¨)
    (      )  Call the following function with the original argument on the right
'!'⊸          and '!' on the left:
         ∾¨     Concatenate each (prepends '!' to each character, resulting
                in a list of two-character strings)
       ∾´       Right-fold that list on concatenation
     ⊣          with a starting value of the left argument (i.e. '!')

A port of Sʨɠɠan's APL solution is also 11 bytes:
(∾⊢∾∾¨)⟜'!'

Try it!

(,) 111 91 Chars or \$91\log_{256}(3)\approx18.03\$ Bytes
((),()()()()()()()())((),(())(())(())(())())(,,,(()()),(,(()(),((()()())),,(())))(()()),())

TIO

C, 42 bytes
f(char *s){printf("!%c",*s);if(*s++)f(s);}

Essentially to not have to have two printf statments I have the printf run on the null byte of the string which prints the '!' but the null byte is ignored.
Easier to read
f(char *s){
  // Prints ! and char of string
  printf("!%c", *s);

  // If more string than recurse for next char
  if(*s != 0) f(s+1);
}

I don't know much C, would removing that space be valid?

Husk, 10 8 bytes
-2 bytes thanks to Razetime!
`:'!ṁe'!

Try it online!

x86-16 machine code, 8 bytes
00000000: b021 aaa4 aae2 fcc3                      .!......

Listing:
B0 21       MOV  AL, '!'        ; character to insert
AA          STOSB               ; write first ! to output string
        CLOOP:
A4          MOVSB               ; copy input char to output string
AA          STOSB               ; write ! to output string
E2 FC       LOOP CLOOP          ; loop until end of input
C3          RET                 ; return to caller

Callable function, input at SI, length in CX.  Output to string at DI.
Test runs:

Julia, 21 20  19 bytes
x->'!'join(x,!)*'!'

Try it online!

Python 3, 80 bytes
s=list(input())
n=0
print(end="!")
for x in s:
    print(s[n],end="!")
    n=n+1

Try it online!

You do not need n, as you can reference to the nth item in the list by using the variable x (Remove n completely and change s[n] to x).

ARM Thumb machine code, 12 bytes
21 22 08 c8 0c c1 00 2b fb d1 70 47

Assembly source:
    .syntax unified
    .arch armv7-a
    .thumb
    .thumb_func
    .globl insert_between
// input: r0: pointer to null terminated UTF-32LE string
//        r1: pointer to buffer
// output: null terminated UTF-32LE string at *r1
// C callable prototype:
//   void insert_between(const char32_t *in, char32_t *out);
insert_between:
    // Put '!' in a register for later
    movs   r2, #'!'
.Lloop:
    // Load char from pointer, advance pointer
    ldmia  r0!, {r3}                          @ tmp = *in++;
    // Store '!' then the char from the pointer.
    // The null terminator will be included,
    // which also adds the trailing '!'.
    stmia  r1!, {r2, r3}                      @ *out++ = '!', *out++ = tmp;
    // Loop if r3 wasn't a null terminator
    cmp    r3, #0
    bne    .Lloop
    // return
    bx     lr

Callable from C with the following prototype:
void insert_between(const char32_t *in, char32_t *out);

As with most of my Thumb string solutions, everything is null terminated UTF-32 thanks to ldmia and stmia being the only narrow instructions to load and advance a pointer.

><> (Fish), 18 bytes
'!'orl0=?;o'!'o40.

Try it

Thunno 2, 5 bytes
""'!v

Attempt This Online!
Thunno 2, 6 bytes
'!j'!ṛ

Attempt This Online!
Explanations
""'!v  # Implicit input
    v  # Replace...
""     # ...the empty string...
  '!   # ...with "!" in the input
       # Implicit output

'!j'!ṛ  # Implicit input
'!j     # Join by "!"
   '!ṛ  # Surround by "!"
        # Implicit output

Rust, 25 bytes
|s:&str|s.replace("","!")

Attempt This Online!

Marbles, 2087 bytes
An elegant 25 x 31 grid of 774 characters:
○══════════════════════╗
║○═══════════════════╗ ║
║║○════════════════╗ ║ ║
║║║○═════════════╗ ║ ║ ║
║║║║○══════════╗ ║ ║ ║ ║
║║║║║○═══════╗ ║ ║ ║ ║ ║
║║║║║║○════╗ ║ ║ ║ ║ ║ ║
║║║║║║║○═╗ ║ ║ ║ ║ ║ ║ ║
║║║║║║║║○╜○╜○╜○╜○╜○╜○╜○╜
║║║║║║║║ ┃ ║ ║ ║ ║ ┃ ║ ║
║║║║║║║║◆╢◆╢◆╢◆╢◆╢◆╢◆╢◆╢
║║║║║║║║ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
║║║║║║║║◇╢◇╢◇╢◇╢◇╢◇╢◇╢◇╢
║║║║║║║║○╬═╬═╬═╬═╬═╬═╬╗║
║║║║║║║║║║╔╬╗║╔╬╗║╔╬╗║║║
║║║║║║║║╓╢╙╢╓╢╙╢╓╢╙╢╓╢╙╢
║║║║║║║║╚╬╝║╚╬╝║╚╬╝║╚╬╝║
║║║║║║║║○╜○╜○╜○╜○╜○╜○╜○╜
║║║║║║║║ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
║║║║║║║║◇╜◇╜◇╜◇╜◇╜◇╜◇╜◇╜
║║║║║║║║◆╢◆╢◆╢◆╢◆╢◆╢◆╢◆╢
║║║║║║║║ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
║║║║║║║║◇╢◇╢◇╢◇╢◇╢◇╢◇╢◇╢
║║║║║║║╚═╝ ║ ║ ║ ║ ║ ║ ║
║║║║║║╚════╝ ║ ║ ║ ║ ║ ║
║║║║║╚═══════╝ ║ ║ ║ ║ ║
║║║║╚══════════╝ ║ ║ ║ ║
║║║╚═════════════╝ ║ ║ ║
║║╚════════════════╝ ║ ║
║╚═══════════════════╝ ║
╚══════════════════════╝

Marbles is not available on tio.run yet but the test examples can be run using marbles.py:
± echo test | ./marbles.py exclamation.txt --quiet --no-display
!t!e!s!t!
!

Ungolfed version:
╔══════════════════════════════════════════════════╗
║  ╔════════════════════════════════════════════╗  ║
║  ║  ╔══════════════════════════════════════╗  ║  ║
║  ║  ║  ╔════════════════════════════════╗  ║  ║  ║
║  ║  ║  ║  ╔══════════════════════════╗  ║  ║  ║  ║
║  ║  ║  ║  ║  ╔════════════════════╗  ║  ║  ║  ║  ║
║  ║  ║  ║  ║  ║  ╔══════════════╗  ║  ║  ║  ║  ║  ║    ┓ 8 marbles representing a byte
║  ║  ║  ║  ║  ║  ║  ╔════════○  ○  ○  ○  ○  ○  ○  ○    ┛ This is the main variable
║  ║  ║  ║  ║  ║  ║  ║        ╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗  ┓
║  ║  ║  ║  ║  ║  ║  ║        ╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝  ┃
║  ║  ║  ║  ║  ║  ║  ║     ○══╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╗ ┃ Synchronization
║  ║  ║  ║  ║  ║  ║  ║     ║  ╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗║ ┃ Right-most marble exits first
║  ║  ║  ║  ║  ║  ║  ║     ║  ╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝║ ┃
║  ║  ║  ║  ║  ║  ║  ║     ╚══╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╝ ┛
║  ║  ║  ║  ║  ║  ║  ║        ╙○ ╙○ ╙○ ╙○ ╙○ ╙○ ╙○ ╙○   ┓ Set value to 0x21
║  ║  ║  ║  ║  ║  ║  ║        ║  ║  ┃  ║  ║  ║  ║  ┃    ┛ (the ascii character '!')
║  ║  ║  ║  ║  ║  ║  ║        ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆   ┓
║  ║  ║  ║  ║  ║  ║  ║        ┃  ┃  ┃  ┃  ┃  ┃  ┃  ┃    ┃ Write the byte to stdout
║  ║  ║  ║  ║  ║  ║  ║        ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇   ┃ LSB is on the right
║  ║  ║  ║  ║  ║  ║  ║        ┃  ┃  ┃  ┃  ┃  ┃  ┃  ┃    ┛
║  ║  ║  ║  ║  ║  ║  ║        ╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗  ┓
║  ║  ║  ║  ║  ║  ║  ║        ╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝  ┃
║  ║  ║  ║  ║  ║  ║  ║     ○══╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╗ ┃ Synchronization
║  ║  ║  ║  ║  ║  ║  ║     ║  ╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗╚═╗║ ┃ Right-most marble exits first
║  ║  ║  ║  ║  ║  ║  ║     ║  ╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝╔╤╝║ ┃
║  ║  ║  ║  ║  ║  ║  ║     ╚══╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╬╛═╝ ┛
║  ║  ║  ║  ║  ║  ║  ║        ╙○ ╙○ ╙○ ╙○ ╙○ ╙○ ╙○ ╙○   ┓ Read a byte from stdin
║  ║  ║  ║  ║  ║  ║  ║        ┃  ┃  ┃  ┃  ┃  ┃  ┃  ┃    ┃ LSB is on the right
║  ║  ║  ║  ║  ║  ║  ║        ╙◇ ╙◇ ╙◇ ╙◇ ╙◇ ╙◇ ╙◇ ╙◇   ┛
║  ║  ║  ║  ║  ║  ║  ║        ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆ ╟◆   ┓
║  ║  ║  ║  ║  ║  ║  ║        ┃  ┃  ┃  ┃  ┃  ┃  ┃  ┃    ┃ Write the byte to stdout
║  ║  ║  ║  ║  ║  ║  ║        ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇ ╟◇   ┃ LSB is on the right
║  ║  ║  ║  ║  ║  ║  ║        ┃  ┃  ┃  ┃  ┃  ┃  ┃  ┃    ┛
║  ║  ║  ║  ║  ║  ║  ╚════════╝  ║  ║  ║  ║  ║  ║  ║
║  ║  ║  ║  ║  ║  ╚══════════════╝  ║  ║  ║  ║  ║  ║
║  ║  ║  ║  ║  ╚════════════════════╝  ║  ║  ║  ║  ║
║  ║  ║  ║  ╚══════════════════════════╝  ║  ║  ║  ║
║  ║  ║  ╚════════════════════════════════╝  ║  ║  ║
║  ║  ╚══════════════════════════════════════╝  ║  ║
║  ╚════════════════════════════════════════════╝  ║
╚══════════════════════════════════════════════════╝

This is the first marbles submission ever :)


text:
Lazy brainfuck programmer
Background
Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation to make programming easier and faster.
The challenge
Let's look at snippet written by Joe a moment ago:
0+++++1+++++0[3+0-]+1[3-2+1-]2[1+2-]3[0-3[-]]

This program was meant to check for equality of #0 and #1 cells in memory. Your task is to create a preprocessor for Joe, that will replace single digits from input with '>' and '<' characters, so the memory pointer will slide to cell specified.
Input
You may take input from any source - function parameter, standard input, or any other device. The input might be in form of a stream, string, or a byte array.
The input may contain characters from all over the ASCII range, but can't contain brainfuck memory pointer instructions (< & >).
All the digits you see in the input are expected to be placed here just for your program.
Output
As Joe didn't write his preprocessor yet, he had to make the code interpretable by hand. That's the result he got:
+++++>+++++<[>>>+<<<-]+>[>>-<+<-]>[<+>-]>[<<<->>>[-]]

There are pretty much no restrictions on output - if the input has braces unbalanced, just copy them over in unbalanced amount to the output.
Bonus tasks
If you think the challenge is too boring in current form, you might want to complete these tasks aswell for slight byte count reduction, and more fun obviously:

Optimize out nonsense related to memory operations, like digits at the end of input or clustered digits (just take the last one) - 20% of byte amount when completed
Minify Brainfuck output (remove clustered +-, ><, non-brainfuck, comments and other kind of stuff) - 20% of byte amount when completed

Rules

Standard loopholes are forbidden by default
Default I/O rules apply
Programs are scored by their size in bytes.
Solving additional tasks reduces the score.
If anything is unclear, please let me know down in the comments
Scoring of bonus tasks may increase (but not decrease!) in the future.

Opening bid - C, 144 bytes
p,c,x;void g(v){x=v?'<':'>';if(v<0)v*=-1;while(v--)putchar(x);}main(){while((c=getchar())!=-1)if(isdigit(c)){c-=48;g(c-p);p=c;}else putchar(c);}

This program should make pretty much everything clear on the input and output side of this challenge, it doesn't implement any bonus tasks though.

Jelly, 18 bytes
V©_¥®N,$Ø<xµ¹e?ØD)

A full program. Assumes (like everyone else has) that no actual Brainfuck evaluation has to be made (no balancing of unbalanced brackets)
Try it online!
How?
V©_¥®N,$Ø<xµ¹e?ØD) - Main Link: list of characters, s
                 ) - for each character, c, in s:
               ØD  -   digits = "0123456789"
              ?    -   if...
             e     -   ...condition: (c) exists in? (digits)
           µ       -   ...then: monadic link:
    ®              -            recall from register (initially 0)
   ¥               -            last two links as a dyad i.e. f(c, ®):
V                  -              evaluate (c)
 ©                 -              (copy to the register)
  _                -              subtract (®)  i.e. x = value(c) - register
       $           -            last two links as a monad i.e. f(x):
     N             -              negate (x)
      ,            -              pair with (x)  -> [-x,x]
        Ø<         -            list of characters = "<>"
          x        -            repeat (vectorises) - negatives act like 0
            ¹      -   ...else: identity - i.e. f(c) -> c
                   - implicit (smashing) print

JavaScript (ES6), 63 bytes
s=>s.replace(/\d/g,n=>'<>'[+(p<n)].repeat(p<n?n-p:p-n,p=n),p=0)

Try it online!

This is black magic. I assume there's a closure of some kind over p, but I just can't understand this!

@wizzwizz4 p is defined in the global scope and initialized in the 3rd dummy parameter of replace, before it starts doing its job.

Could you use the RegEx (or function) as the initial value for p to save a couple of bytes?

@Shaggy I don't think so. That would fail if the first referenced cell is not $0$ and there's no reason why it should always be $0$.

What about s=>s.replace(p=/\d/g,n=>'<'.repeat(p)+'>'.repeat(p=n))?

Japt v2.0a0, 20 16 bytes
r\d@Tî< +'>pT=Xn

Try it
Saved 4 bytes porting a comment by tsh on Arnauld's solution which I've been told results in valid BF output.
r\d@Tî< +'>pT=Xn     :Implicit input of string
r                    :Replace
 \d                  :Digits (RegEx /\d/g)
   @                 :Pass each match X through a function
    Tî<              :  T (initially 0) time repeat "<"
        +            :  Append
         '>p         :  Repeat ">"
            T=Xn     :    Convert X to an integer and assign it to T for the next match

Second one is perfectly fine.

Perl 6, 48 bytes
{$!=0;S:g{\d}=['<','>'][$/>$!]x abs +$!-($!=$/)}

Try it online!
Substitutes all digits with the appropriate character repeated the difference between the previous amount of times

05AB1E, 19 18 bytes
εDdi®α„><®y©@è×]J¦

Try it online!

Python 3.6, 93 90 83 79 77 bytes
p=0
for s in input():
 try:a=int(s)-p;s='>'*a+'<'*-a;p+=a
 except:0
 print(s)

Try it online
Thanks to @JonathanAllan for -2 bytes.

Old version 90 bytes:
p=0
for s in input():
 if '/'<s<':':a=int(s);print('>'*(a-p)+'<'*(p-a));p=a
 else:print(s)

Thanks to @EmbodimentofIgnorance for -3 bytes.

I don't think this would work if the input had a multidigit number

@EmbodimentofIgnorance The spec says single digits.

'/'<s<':' instead of 46<ord(s)<58

Save two by avoiding two prints

Pyth, 34 bytes
VzI}N."09IÒ"p*\<Zp*\>KsN=ZK.?pN)

With unprintable string \x96\x02 between ."09I and Ò
Explained:
Vz                                  # For N in input
  I}N."09IÒ"                        # If N is in the packed string 1234567890
               p*\<Z                # Print Z * "<"
                    p*\>KsN         # K = int(N) and print ">" * K
                           =ZK      # Z = K
                              .?pN) # Else print N

C# (Visual C# Interactive Compiler), 103 99 bytes
x=>{int i=48;foreach(var g in x)Write(g<58&g>47?new string(g-i<0?'>':'<',Math.Abs(i-(i=g))):g+"");}

Try it online!

96 bytes by rewriting a single-statement foreach loop into LINQ. This might be possible to improve with Aggregate, but I can't so far.

Suggest g<i instead of g-i<0

Retina 0.8.2, 27 bytes
\d(\D*)
$*>$1$&$*<
+`<>|<$

Try it online! Explanation:
\d(\D*)

Match a digit and then all intervening non-digits.
$*>$1$&$*<

Slide the memory pointer to the desired cell, then after the intervening code, slide it back to the initial cell.
+`<>|<$

Cancel out any overlapping slides and delete any trailing slides.

source: Stack Exchange

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

sort: votes


text:
Write a radiation-hardened irradiator
The task is to write a radiation-hardened irradiator. What do I mean by that, exactly?
An irradiator is a program that, when given a string as input, will output all possible versions of the string with one character removed. For example, given the input Hello, world!, the program should output:
ello, world!
Hllo, world!
Helo, world!
Helo, world!
Hell, world!
Hello world!
Hello,world!
Hello, orld!
Hello, wrld!
Hello, wold!
Hello, word!
Hello, worl!
Hello, world

An irradiator, however, must be protected from its radiation, so the irradiator you write must also survive when put through itself. That is, when any single byte of your program is removed, the program must still function properly.
Test cases
abc -> bc; ac; ab
foo bar -> oo bar:fo bar:fo bar:foobar:foo ar:foo br:foo ba
source -> ource;surce;sorce;souce;soure;sourc;

Specifications

You may take input by any acceptable method by our Standard I/O rules
The output may be either a list of strings or a printed list delimited by a character or group of characters. A trailing delimiter is acceptable
The output may be in any order as long as it contains all of the possible versions
Duplicate entries (such as the two Helo, world!s in the first example) may be filtered out, but this is not necessary
As this is code-golf, the smallest program, in bytes, wins

...or comma perhaps?

this one is really favouring golfing languages, because C program with v in void removed won't compile

@Krzysztof tbh I think most if not all practical languages won't survive radiation hardening because of the verbosity and the syntaxes. Not only this challenge, but ALL RH challenges.

05AB1E, 29 26 bytes
æIg<ùˆ\æIg<ùˆ\æIg<ùˆ¯¯{Å`s

Try it online!, or try all irradiated versions.
The shortest irradiator I could find is 5 bytes:
æ        # powerset of the input
 Ig      # length of the input
   <     # - 1
    ù    # elements of a with length b

The idea is to repeat that 3 times, then do majority voting:
æIg<ù         # irradiate
     ˆ        # add the result to the global array
      \       # pop (in case the above instruction gets irradiated)
æIg<ùˆ\       # idem
æIg<ùˆ        # no pop, it's okay to dirty the stack at this point
¯             # push global array
 ¯            # and again, so at least one goes through
  {           # sort
   Å          # conveniently ignored by the parser
    `         # dump
     s        # swap
              # and implicitly output

Å is a prefix for 2-byte commands, but there's no Å` command, which is why the Å gets ignored. We'll need it later, though.
Sorting makes sure the majority vote is in the middle of the array. Dumping then swapping gets that value to the top of the stack.
Any irradiation in the initial part only results in an error in the global array, which gets solved by the majority vote. Irradiations in the final {Å`s bit are much trickier to reason about:

Å is ignored anyway, so it's okay to irradiate it
If the backtick is irradiated, Å`s becomes Ås, which is the "get middle of the array" extended command.
If { or s are irradiated, that means nothing else is, so the global array is the same value three times. In that case we don't need sorting/swapping, any value will work.

Very impressive! I didn't think I'd see a 05AB1E answer on a RH challenge. I'll add a bounty to reward this answer (and give the challenge a bit more exposure as well I guess) right away. You've golfed so many answers of mine, so you deserve loads of credit for those as well! :)

Actually, I've seen 05AB1E answers on a RH challenge before. Still, very impressive!

8086 machine code (MS-DOS .COM), 83 bytes
Runnable in DOSBox or your favourite steam-powered computing engine. The string to irradiate is given as a command line argument.
Binary:
00000000 : EB 28 28 8A 0E 80 00 49 BD 83 00 B4 02 51 8A 0E : .((....I.....Q..
00000010 : 80 00 BE 82 00 AC 39 EE 74 04 88 C2 CD 21 E2 F5 : ......9.t....!..
00000020 : 59 45 B2 0A CD 21 E2 E5 C3 90 EB D7 D7 8A 0E 80 : YE...!..........
00000030 : 00 49 BD 83 00 B4 02 51 8A 0E 80 00 BE 82 00 AC : .I.....Q........
00000040 : 39 EE 74 04 88 C2 CD 21 E2 F5 59 45 B2 0A CD 21 : 9.t....!..YE...!
00000050 : E2 E5 C3                                        : ...

Readable:
cpu 8086
org 0x100
    jmp part2
    db 0x28

part1:
    mov cl, [0x80]
    dec cx
    mov bp, 0x83
    mov ah, 0x02

.l:
    push cx
    mov cl, [0x80]
    mov si, 0x82
.k:
    lodsb
    cmp si, bp
    je .skip
    mov dl, al
    int 0x21
.skip:
    loop .k
    pop cx
    inc bp
    mov dl, 10
    int 0x21
    loop .l
    ret

    nop
part2:
    jmp part1
    db 0xd7
    mov cl, [0x80]
    dec cx
    mov bp, 0x83
    mov ah, 0x02

.l:
    push cx
    mov cl, [0x80]
    mov si, 0x82
.k:
    lodsb
    cmp si, bp
    je .skip
    mov dl, al
    int 0x21
.skip:
    loop .k
    pop cx
    inc bp
    mov dl, 10
    int 0x21
    loop .l
    ret

Rundown
The active part is duplicated so that there is always one untouched by radiation. We select the healthy version by way of jumps. Each jump is a short jump, and so is only two bytes long, where the second byte is the displacement (i.e. distance to jump, with sign determining direction).
We can divide the code into four parts which could be irradiated: jump 1, code 1, jump 2, and code 2. The idea is to make sure a clean code part is always used. If one of the code parts is irradiated, the other must be chosen, but if one of the jumps is irradiated, both code parts will be clean, so it will not matter which one is chosen.
The reason for having two jump parts is to detect irradiation in the first part by jumping over it. If the first code part is irradiated, it means we will arrive one byte off the mark. If we make sure that such a botched landing selects code 2, and a proper landing selects code 1, we're golden.
For both jumps, we duplicate the displacement byte, making each jump part 3 bytes long. This ensures that irradiation in one of the two last bytes will still make the jump valid. Irradiation in the first byte will stop the jump from happening at all, since the last two bytes will form a completely different instruction.
Take the first jump:
EB 28 28        jmp +0x28 / db 0x28

If either of the 0x28 bytes are removed, it will still jump to the same place. If the 0xEB byte is removed, we will instead end up with
28 28           sub [bx + si], ch

which is a benign instruction on MS-DOS (other flavours might disagree), and then we fall through to code 1, which must be clean, since the damage was in jump 1.
If the jump is taken, we land at the second jump:
EB D7 D7        jmp -0x29 / db 0xd7

If this byte sequence is intact, and we land right on the mark, that means that code 1 was clean, and this instruction jumps back to that part. The duplicated displacement byte guarantees this, even if it is one of these displacement bytes that were damaged. If we either land one byte off (because of a damaged code 1 or jump 1) or the 0xEB byte is the damaged one, the two remaining bytes will also here be benign:
D7 D7           xlatb / xlatb

Whichever the case, if we end up executing those two instructions, we know that either jump 1, code 1, or jump 2 were irradiated, which makes a fall-through to code 2 safe.
Testing
The following program was used to automatically create all versions of the .COM file. It also creates a BAT file that can be run in the target environment, which runs each irradiated binary, and pipes their outputs to separate text files. Comparing the output files to validate is easy enough, but DOSBox does not have fc, so it was not added to the BAT file.
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    FILE *fin, *fout, *fbat;
    int fsize;
    char *data;

    if (!(fin = fopen(argv[1], "rb")))
    {
        fprintf(stderr, "Could not open input file \"%s\".\n", argv[1]);
        exit(1);
    }

    if (!(fbat = fopen("tester.bat", "w")))
    {
        fprintf(stderr, "Could not create BAT test file.\n");
        exit(2);
    }

    fseek(fin, 0L, SEEK_END);
    fsize = ftell(fin);
    fseek(fin, 0L, SEEK_SET);

    if (!(data = malloc(fsize)))
    {
        fprintf(stderr, "Could not allocate memory.\n");
        exit(3);
    }

    fread(data, 1, fsize, fin);

    fprintf(fbat, "@echo off\n");

    for (int i = 0; i < fsize; i++)
    {
        char fname[512];

        sprintf(fname, "%03d.com", i);
        fprintf(fbat, "%s Hello, world! > %03d.txt\n", fname, i);

        fout = fopen(fname, "wb");

        fwrite(data, 1, i, fout);
        fwrite(data + i + 1, 1, fsize - i - 1, fout);

        fclose(fout);
    }

    free(data);
    fclose(fin);
    fclose(fbat);
}

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


text:
Identical grids
You’re given two \$r×c\$ grids. Each cell contains either 0 or 1. What are the minimum number of swaps (between horizontally and vertically adjacent cell elements, no wrapping i.e no swapping between last and first element of a row) are required in the first grid for it to match the second. If the matched arrangement can never be achieved, output -1.
Constraints
\$1 \leq r \leq 100\$
\$1 \leq c \leq 100 \$
Examples
input:
00
11

01
10
output:
1

input:
00
11

01
00
output:
-1

input:
0011011

0101101
output:
2

I have a strong feeling that this is a duplicate but can't find one...

Also, I highly recommend using The Sandbox to get feedback on a challenge. I do think this is an interesting challenge, but you only stand to gain by posting there first, and at worst you lose a day or two.

What is a swap? Please define it more rigorously.

Is it adjacent? Any two items? Cycling any n items?

@HyperNeutrino, by swap I mean exchanging the values of two adjacent cells.

@wizzwizz4, swap between adjacent elements, no cycles.

When you say "adjacent" do you include diagonally adjacent?

@LuisMendo, only horizontally and vertically adjacent.

Is this a question from another site?

@KrzysztofSzewczyk Even after you commented that, there was still a clarification to be made. So, stop berating others for requesting clarification; just because (you think) you get it doesn't mean others have to.

@KrzysztofSzewczyk If a challenge isn't clear and we can't request clarification, the alternative method is to VTC it, which is much worse of a solution for an almost perfectly fine challenge otherwise. I don't see OP getting angry; if you are, you have every right to ignore our comments.

Python 3, 383 334 bytes
-6 bytes thanks to @Kevin Cruijssen
-43 bytes thanks to @Jitse
import numpy
z=len
d=lambda a,b,c,d:abs(a-c)+abs(b-d)
def g(l,m):
 if z(l)==1:yield d(*l[0],*m[0])
 for i in range(z(l)):
  for s in g(l[1:],m[:i]+m[i+1:]):yield d(*l[0],*m[i])+s
def c(a,b):
 e=a-b;k=z(a);f,*h=[],
 for x in range(k*z(a[0])):w=[(x%k,x//k)];v=e[x%k][x//k];f+=w*(v>0);h+=w*(v<0)
 return-1 if numpy.sum(e)else min(g(f,h))

Try it online!
Takes input as two numpy arrays.
Explanation:
First, e=a-b determines which positions change from one grid to the other.
The next line finds all of the differences and sorts them into the lists f
and h. If the sum of differences is not zero, meaning there are more 1s in
one grid than the other, this returns -1, or the minimum of all possible
paths found by g.
This is the fun part. Essentially, in order to make this work, a 1 must move from one position to another by swapping. Therefore, the minimum number of swaps for each pair is the manhattan distance between them, found in d. g
finds every possible pairing between start and end points and returns a list
of the total distances between them. If there is only one start point, it returns the distance between that and the end point. Beyond that, it pairs the first start point with each end point iteratively and adds their distance to the total distance of the rest of the points, calculated recursively.

-6 bytes with some simple golfs (removed some spaces, and changed !=0 to >0)

-43 bytes

If I'm understanding this correctly, does it run on O(n!)?  Obviously fine for golf, but just out of curiosity do you know if there's a more efficient algorithm?

@Jonah Technically it's O(n!!) in the total number of spaces to be swapped minus 1 (135*7...). I'm nearly certain that a more efficient algorithm exists, since this is brute forcing every possible solution.

APL (Dyalog Extended), 35 bytes
{⍺≠⍥≢⍵:¯1⋄⌊/⍺[⌂pmat≢⍺]+.(1⊥∘|-)⍵}⍥⍸

Try it online!
A function that takes two Boolean matrices as left and right arguments.
Uses Hiatsu's algorithm. One additional thing to point out is that, while moving a 1 from some position to another, it may freely step over some ones and still take the same steps. Therefore, the pairwise Manhattan distances can be summed without interfering each other. (This doesn't invalidate the previous answers; rather, it covers a hole in the proof that the algorithm is indeed correct.)
Moving the one at the start to the end:
1 0 0 0 0 1 1 1 0 0 0
^------->              Move the 1 four steps forward
0 0 0 0 1 1 1 1 0 0 0
        <-------^      Move the 0 four steps backwards
0 0 0 0 0 1 1 1 1 0 0  (See that the target 1 has moved 4 steps forward as net effect)
                ^--->  Finally move the 1 to the destination
0 0 0 0 0 1 1 1 0 0 1
So the 1 has travelled the distance of 10 in 10 steps, stepping over ones

How it works: the code
{⍺≠⍥≢⍵:¯1⋄⌊/⍺[⌂pmat≢⍺]+.(1⊥∘|-)⍵}⍥⍸  ⍝ Main function
{                               }⍥⍸  ⍝ Extract coordinates of ones from both args
 ⍺≠⍥≢⍵:     ⍝ If the lengths (count of ones) do not match,
       ¯1   ⍝ Return minus 1
         ⋄  ⍝ Otherwise,
            ⍺[⌂pmat≢⍺]            ⍝ All permutations of coordinates of left arg
                      +.(1⊥∘|-)⍵  ⍝ Inner product with ⍵ to get Manhattan distance sum:
                        (1⊥∘|-)   ⍝ sum the absolute differences of coords point-wise
                      +.          ⍝ and sum all the distances
          ⌊/                      ⍝ Pick the minimum value

Based on @Hiatsu's answer.

Python 3, 262 bytes
e=enumerate
def f(r,s):
 if not r:yield 0
 for i,t in e(r):yield abs(t[0]-s[0][0])+abs(t[1]-s[0][1])+min(f(r[:i]+r[i+1:],s[1:]))
def g(x,y):
 z=x-y;n=len(x.T);v,*w=[],
 for i,p in e(z.flat):t=[(i%n,i//n)];v+=t*(p>0);w+=t*(p<0)
 return-1if z.sum()else min(f(v,w))

Try it online!