Bring Out The Inner Llama Of A Sentence
Answer : Perl, 52 bytes The solution is provided as function that takes the string as argument and returns a list of positions. One-based positions, case-sensitive search, without newlines: 52 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/;@+[1..$#+]} The case-sensitive search returns an empty array in the example of the question, because after matching the first three letters the lowercase letter m is missing in the input text. Support of newlines: + 1 byte = 53 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/s;@+[1..$#+]} The text can now span several lines. Case-insensitive search: + 1 byte = 54 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/si;@+[1..$#+]} Now the example in the question reports a list of index positions, they are one-based numbers: [45 68 77 106 115] Zero-based positions: + 9 bytes = 63 bytes sub l{pop=~/(l).*?(l).*?(a).*?(m).*?(a)/si;map{$_-1}@+[1..$#+]} Result for the example in the question: [44 67 76 105 114] Ungolfed: The l...