Generalization of abbreviations Given an input of a list of words and their abbreviations, output the pattern
by which the abbreviations can be formed.

Let us take the example input of

potato ptao
puzzle pzze


as an example (that is, the abbreviation for potato is ptao, and the
abbreviation for puzzle is pzze).

Consider all possible ways to obtain ptao from potato. One possible way is
to take the first, third, fourth, and sixth letters, which we will refer to as
1346. But since t and o appear multiple times in the word, there are
multiple other possible ways to generate ptao from potato: 1546, 1342,
and 1542.

Similarly, note that pzze can be generated from puzzle with any of 1336,
1346, 1436, 1446. The only pattern that these two abbreviations have in
common is 1346; therefore, that must be the output for this input. If
multiple possible patterns are possible, you may output any, some, or all of
them (at least one).

You may assume that:


Input words and abbreviations contain only lowercase letter.
There is at least one word/abbreviation pair in the input.
It is possible for every abbreviation to be formed from its corresponding
word.
There will always be at least one pattern that forms every abbreviation.
The maximum length of each word is 9 characters.


Input may be taken as any of the following:


2-dimensional array/list/array of tuples/etc. [[word, abbr], [word, abbr],
...]
flat 1-dimensional array/list [word, abbr, word, abbr, ...]
single string, delimited by any single character that is not a lowercase
letter "word abbr word abbr"
hash/associative array/etc. {word =&gt; abbr, word =&gt; abbr, ...}


In any of these input options, you are also permitted to swap the order of word/abbr (please fully describe the input format in your post).

Output may be given as a single number, a string delimited by non-digits, or an array/list/tuple/etc. of numbers.

Since this is code-golf, the shortest code in bytes will win.

Test cases (remember that you only need to output ≥1 results if multiple
patterns work):

In                                Out
--------------------------------------------------------
potato ptao puzzle pzze         | 1346
aabbcc abc fddeef def           | 246
prgrmming prgmg puzzles pzzlz   | 14353
aaaaa a bbbb b ccc c dd d e e   | 1
aaaaa a bbbb b ccc c            | 1, 2, 3
abcxyz zbcyax                   | 623514
abcxyz acbbacbcbacbbac          | 132213232132213
potato ptao                     | 1346, 1546, 1342, 1542
a aaaaa                         | 11111
MATL, 29 bytes
!&quot;@Y:!=2#fX:wX:h]N$v1XQtv4#X&gt;

Input is a 2D array in the following format:
{'potato' 'ptao'; 'puzzle' 'pzze'}

Try it online! (the linked code includes some modifications owing to changes in the language since this answer was posted)
!       % take input. Transpose
&quot;       % for each column
  @Y:   %   push column. Unpack the two strings and push them onto the stack
  !     %   transpose second string
  =     %   matrix with all pairwise matchings of characters in word and abbreviation
  2#f   %   find row and col indices of those matchings
  X:    %   transform into column vector
  wX:   %   swap, transform into column vector
  h     %   concat into a two-col matrix
]       % end for
N$v     % concatenate all matrices containing the indices
1       % push 1
XQ      % build matrix adding 1 for each (row,col) index
tv      % concat vertically with itself, so that it has at least two rows.
        % This forces the following function to work on each col.
4#X&gt;    % arg max of each col: position that produces a match in all pairs.
        % If there are several maximizers in each col this gives the first

The code required some involved (and lengthy!) tricks to

Prevent the orientation of vectors produced by find (f) from changing depending on input shape. These are statements X:wX:: force both outputs to be column vectors.
Counteract the &quot;work along first non-singleton dimension&quot; default behaviour of the min (X&gt;) function. These are statements tv: concat a copy of itself to assure at least two rows);