'Find the index of `word` in `self`.
Examples
>>> from sympy.combinatorics.free_groups import free_group
>>> f, a, b = free_group("a b")
>>> w = a**2*b*a*b**3
>>> w.subword_index(a*b*a*b)
1'

def subword_index(self, word, start=0):

    l = len(word)
    self_lf = self.letter_form
    word_lf = word.letter_form
    index = None
    for i in range(start, ((len(self_lf) - l) + 1)):
        if (self_lf[i:(i + l)] == word_lf):
            index = i
            break
    if (index is not None):
        return index
    else:
        raise ValueError('The    given    word    is    not    a    subword    of    self')
