Oops, I blew it up (with numbers) Inspired by There, I fixed it (with rope), There, I fixed it (with Tape), There, I broke it (with scissors)

Given a string with characters from a-z or A-Z (whichever you prefer), turn missing letters into numbers and make them explode.



Example

Input: abcafabc

Output: a12344321c

Why?

1) Find the missing letters (only going forward in the alphabet): abca(bcde)fabc

2) Replace them with the number of missing letters: abca4fabc

3) Replace the number with


Itself twice if it's even
Itself + 1 if it's odd


In this case: abca44fabc

4) Explode those numbers outwards replacing any letters: a12344321c



Challenge Rules


Explosions can't exceed the boundaries of the string


ae -&gt; 343 (3 letters are missing but since 3 is odd, it's been replaced by 4)

Numbers can be greater than 9


az -&gt; 23242423 (24 letters are missing and since 24 is even, it's repeated twice)

You can have multiple explosions


abcefghijmnop -&gt; ab121fghi1221nop

Multiple explosions can overlap, take the sum of the number when they do


abceghij -&gt; abc(2)e(2)ghij -&gt; ab12(1+1)21hij -&gt; ab12221hij

It's possible that no explosions occur, in that case simply return the string
No explosions between ab, aa, aaa, etc.
You are allowed to take the input in any reasonable format. Can be a single string, string-array/list, character-array/list, etc. Output has the same flexibility.
You are allowed to use lowercase and/or uppercase any way you'd like. This applies both to the input, output.


General Rules


This is code-golf, so the shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-golfing languages.
Standard rules apply.
Default Loopholes are forbidden.
If possible, please add a link to a test for your code, preferably Tio.
Also, please add an explanation if necessary.




Test cases:

Input  : 'abcdefgklmnopqrstuvwxyz'
Output : 'abcd1234321nopqrstuvwxyz'

Input  : 'abdefgjkl'
Output : 'a121ef1221kl'

Input  : 'xyzaz'
Output : '20212223242423'


Input  : 'abceghij'
Output : 'ab12221hij'

Input  : 'zrabc'
Output : 'zrabc'
Ruby, 162 bytes



-&gt;a{b=[*a=a.reduce{|x,y|[*x,*[(n=y.ord+~x[-1].ord)+n%2]*(n&lt;1?0:2-n%2),y]}];i=-1;b.map{|x|d=-~i+=1;a.map!{|y|(z=x.to_i-(d-=1)*s=d&lt;=&gt;0)&lt;1||x==b[i-s]?y:z+y.to_i}};a}


Try it online!

Takes input as an array of chars, returns a mixed array of chars/ints. (I'm still not sure whether this is allowed after reading the comments to the original post. If not allowed, it's +3 bytes to fix).

Explanation

First, we apply a reduce operation, where we aren't actually reducing anything, but rather reconstruct the array a as [*x,*[...],y], where the middle part contains the numbers inserted at ground zero.

We also make a copy of the array: b=[*a] to serve as a reference, so that we don't get confused which numbers are at the center of the explosion, and which ones are introduced later on.

Then we iterate through b and for each element x, iterate through a to record, what effect x will have on each element y of a.

Conveniently, to_i method returns 0 for non-numeric chars, so that we don't have to worry about distinction between numbers and text.

In my initial code, arrays were indexed by i and j, but this was golfed down to use a "delta" value d=i-j.

Another helper variable is the sign of the delta: s=d&lt;=&gt;0. At the first occurrence it performs the same function as abs, and at the second - it helps us to block the other side of one-sided explosions as in 12344321.

Ultimately, if z is estimated to be positive, we add it up with the integer equivalent of y and store in a, otherwise, y remains intact.