Doubled-letter steganography Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII carrier as input, and return or print a package that is identical to the carrier except characters corresponding to the message are doubled, in the same order that they appear in the message.

Rules:


If the carrier already contains sequences of the same character more than once, and they are not used to encode a character of the message, the program will reduce them to a single character.
If the carrier does not contain the message characters in the right order, the program may return nothing, the carrier itself, or an error.
You may assume that the message and carrier are non-empty ASCII strings.
Capitalization matters: A is not equivalent to a.
When more than one package is valid, your program may output any or all of them.
Space is a character like any other character.


Test cases:


Message      Carrier              Package
"hi"         "has it arrived?"    "hhas iit arived?" OR "hhas it ariived?"
"sir"        "has it arrived?"    "hass iit arrived?"
"foo"        "has it arrived?"    "" OR "has it arrived?" OR an error.
"Car"        "Cats are cool."     "CCaats arre col."
"car"        "Cats are cool."     "" OR "Cats are cool." OR an error.
"Couch"      "Couch"              "CCoouucchh"
"oo"         "oooooooooo"         "oooo"
"o o"        "oooo oooa"          "oo  ooa"


This is code golf, so fewest bytes wins.
Jelly, 28 bytes

ẹⱮŒp&lt;ƝẠ$ƇṪ
nƝ+çṬ¥a⁸ḟ0Ḥç¦ð¹ç?


A full program taking carrier and message as command line arguments which prints the result
(For a non-packable message prints the unchanged carrier).

Try it online! Or see the test-suite.

How?

ẹⱮŒp&lt;ƝẠ$ƇṪ - Link 1, helper function to find the indices to double: carrier, message
           -                               e.g. "programming", "rom"
 Ɱ         - map across message with:
ẹ          -   indices of                       [[2,5], [3], [7,8]]
  Œp       - Cartesian product                  [[2,3,7],[2,3,8],[5,3,7],[5,3,8]]
        Ƈ  - filter keep if:
       $   -   last two links as a monad:
     Ɲ     -     for neighbours:
    &lt;      -       less than?                    [1,1]   [1,1]   [0,1]   [0,1]
      Ạ    -     all truthy?                     1       1       0       0
           -                                    [[2,3,7],[2,3,8]]
         Ṫ - tail (if empty yields 0)                    [2,3,8]

nƝ+çṬ¥a⁸ḟ0Ḥç¦ð¹ç? - Main Link: carrier, message
                ? - if...
               ç  - ...condition: last Link (the helper function) as a dyad
             ð    - ...then: perform the dyadic chain to the left (described below)
              ¹   - ...else: do nothing (yields carrier)
                  - (the then clause:)
 Ɲ                - for neighbours in the carrier
n                 - not equal?
     ¥            - last two links as a dyad:
   ç              -   call last Link (the helper function) as a dyad
    Ṭ             -   untruth (e.g. [2,5] -&gt; [0,1,0,0,1])
  +               - add (vectorises)
      a⁸          - logical AND with carrier
        ḟ0        - filter out zeros
            ¦     - sparse application...
           ç      - ...to indices: call last Link (the helper function) as a dyad
          Ḥ       - ...do: double (e.g. 'x' -&gt; 'xx')