def permutations(mystring):
    """
    Recursive function that computes the permutation of a
    given string, e.g. eat => eat, eta, aet, ate, tea, tae
    @param str mystring: given string
    @rtype: list
    """
    result = []

    if len(mystring) == 0:
        result.append(mystring)
        return result
    else:
        for i in range(len(mystring)):
            shorter = mystring[ : i] + mystring[i + 1 : ]
            print('Shorter: ', shorter)
            shorterPermutations = permutations(shorter)

            for eachChar in shorterPermutations:
                result.append(mystring[i] + eachChar)

        return result

for x in permutations("eat"):
    print(x)
