code: def _advanced_acronym_detection(s, i, words, acronyms):
      acstr = ''.join(words[s:i])
      range_list = []
      not_range = set(range(len(acstr)))
      for acronym in acronyms:
          rac = regex.compile(unicode(acronym))
          n = 0
          while True:
              m = rac.search(acstr, n)
              if not m:
                  break
              a, b = m.start(), m.end()
              n = b
              ok = True
              for r in range_list:
                  if a < r[1] and b > r[0]:
                      ok = False
                      break
              if ok:
                  range_list.append((a, b))
                  for j in xrange(a, b):
                      not_range.remove(j)
      for nr in not_range:
          range_list.append((nr, nr + 1))
      range_list.sort()
      for _ in xrange(s, i):
          del words[s]
      for j in xrange(len(range_list)):
          r = range_list[j]
          words.insert(s + j, acstr[r[0]:r[1]])
      return s + len(range_list) - 1