A string S of length between 2 and 30. The only letters in the string will be
All strings within Levenshtein distance 2 of S. You must output all the strings without duplicates but in any order you like.
S = aaa then the output would be (in any order):
aa abab ab aabba aaaa abaa bbaaa aba bbaa babaa bba abaaa abaab baaa baab baaaa baba aabaa ba abba aaba aabb abbaa abb aabab aaaaa aaaab baaba a aaaba aaabb aaa aab ababa aaab bab baa baaab
Your code must be fast enough that it would run to completion on TIO when S is of length 30. This is only to stop brute force solutions.