7 deleted 53 characters in body
source | link

Pyth, 2119 bytes

mhhdm@Fdmhh@Fd.TmmxkmbhdedQ

Try it here!Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into [1,3,4,6] at the cost of 3 bytes.

Code breakdown

mhhdm@Fdmhh@Fd.TmmxkmbhdedQ   # Q = input

  m  m               Q   # map input with d
          m       ed    # map each abbrevation with k
              mbhd      # map word to char list
           xk mxk          # all occurences ofmap each current abbrevation char into thea word
list of indices
      .T              # Transpose
      Fd                # Fold every element
     @                  # and filter on presence
mhhd hh                   # Take first element of the result und and increment it

Pyth, 21 bytes

mhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into [1,3,4,6] at the cost of 3 bytes.

Code breakdown

mhhdm@Fd.TmmxkmbhdedQ   # Q = input

    m               Q   # map input with d
          m       ed    # map abbrevation with k
              mbhd      # map word to char list
           xk           # all occurences of each current abbrevation char in the word
        .T              # Transpose
      Fd                # Fold every element
     @                  # and filter on presence
mhhd                    # Take first element of the result und and increment it

Pyth, 19 bytes

mhh@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into [1,3,4,6].

Code breakdown

mhh@Fd.TmmxkmbhdedQ   # Q = input

m                 Q   # map input with d
        m       ed    # map each abbrevation with k
            mbhd      # map word to char list
         mxk          # map each abbrevation char to a list of indices
      .T              # Transpose
    Fd                # Fold every element
   @                  # and filter on presence
 hh                   # Take first element of the result und and increment it
6 deleted 77 characters in body
source | link

Pyth 23, 21 bytes

jkmhhdm@Fdmhhdm@Fd.TmmxkmbhdedQ

Try it here!Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into 1346[1,3,4,6] at the cost of 63 bytes.

Code breakdown

jkmhhdm@Fdmhhdm@Fd.TmmxkmbhdedQ   # Q = input

      m               Q   # map input with d
            m       ed    # map abbrevation with k
                mbhd      # map word to char list
             xk           # all occurences of each current abbrevation char in the word
          .T              # Transpose
        Fd                # Fold every element
       @                  # and filter on presence
  mhhd                    # Take first element of the result und and increment it
jk                        # Join the list to one number


Pyth 23 bytes

jkmhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into 1346 at the cost of 6 bytes.

Code breakdown

jkmhhdm@Fd.TmmxkmbhdedQ   # Q = input

      m               Q   # map input with d
            m       ed    # map abbrevation with k
                mbhd      # map word to char list
             xk           # all occurences of each current abbrevation char in the word
          .T              # Transpose
        Fd                # Fold every element
       @                  # and filter on presence
  mhhd                    # Take first element of the result und and increment it
jk                        # Join the list to one number


Pyth, 21 bytes

mhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into [1,3,4,6] at the cost of 3 bytes.

Code breakdown

mhhdm@Fd.TmmxkmbhdedQ   # Q = input

    m               Q   # map input with d
          m       ed    # map abbrevation with k
              mbhd      # map word to char list
           xk           # all occurences of each current abbrevation char in the word
        .T              # Transpose
      Fd                # Fold every element
     @                  # and filter on presence
mhhd                    # Take first element of the result und and increment it
5 added 1 character in body
source | link

Pyth 23 bytes

jkmhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 2717 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists whchwhich yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into 1346 at the cost of 6 bytes.

Code breakdown

jkmhhdm@Fd.TmmxkmbhdedQ   # Q = input

      m               Q   # map input with d
            m       ed    # map abbrevation with k
                mbhd      # map word to char list
             xk           # all occurences of each current abbrevation char in the word
          .T              # Transpose
        Fd                # Fold every element
       @                  # and filter on presence
  mhhd                    # Take first element of the result und and increment it
jk                        # Join the list to one number


Pyth 23 bytes

jkmhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 27 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists whch yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into 1346 at the cost of 6 bytes.

Code breakdown

jkmhhdm@Fd.TmmxkmbhdedQ   # Q = input

      m               Q   # map input with d
            m       ed    # map abbrevation with k
                mbhd      # map word to char list
             xk           # all occurences of each current abbrevation char in the word
          .T              # Transpose
        Fd                # Fold every element
       @                  # and filter on presence
  mhhd                    # Take first element of the result und and increment it
jk                        # Join the list to one number


Pyth 23 bytes

jkmhhdm@Fd.TmmxkmbhdedQ

Try it here!

Takes a list in the following format:

[["word","abbr"],["word","abbr"],...]

Alternative 17 bytes solution which outputs the result as list of zero-based indices which are wrapped in an 1-element list:

m@Fd.TmmxkmbhdedQ

Explanation

Example: [["potato", "ptao"],["puzzle", "pzze"]]

First we map every char in the abbrevation to a list of the indices of all occurences in the word which yields

[[[0], [2, 4], [3], [1, 5]], [[0], [2, 3], [2, 3], [5]]]

Then we transpose this list which gives us

[[[0], [0]], [[2, 4], [2, 3]], [[3], [2, 3]], [[1, 5], [5]]]

So the indices of each char of each abbrevation are together in one list.

Then we just have to find one common index in all of those lists which yields:

[[0], [2], [3], [5]]

This is the output of my alternative 17 byte solution above. This then gets transformed into 1346 at the cost of 6 bytes.

Code breakdown

jkmhhdm@Fd.TmmxkmbhdedQ   # Q = input

      m               Q   # map input with d
            m       ed    # map abbrevation with k
                mbhd      # map word to char list
             xk           # all occurences of each current abbrevation char in the word
          .T              # Transpose
        Fd                # Fold every element
       @                  # and filter on presence
  mhhd                    # Take first element of the result und and increment it
jk                        # Join the list to one number


4 added 358 characters in body
source | link
3 added 358 characters in body
source | link
2 added 358 characters in body
source | link
1
source | link