I need to take a string, e.g. AABCAAADA and split it into a given number of strings, say 3 (but this could be anything). Then, within those strings, delete duplicate chars. The output of this code should be, for the given example, AB, CA and AD.
My code produces DA for the final example and I can't see why this is.
import textwrap
def splitToT(string, number):
wordsList = list(textwrap.wrap(string,number))
for word in wordsList:
t = word
makeU(t)
def makeU(t):
list1 = list(t)
list2 = list(t)
print"list1 = "
print list1
print"list2 = "
print list2
for l1e in list1:
print "element from list1"
print l1e
count = 0
print"COUNT RESET"
for l2e in list2:
print "\t Element in list2"
print("\t" + l2e)
if str(l1e) == str(l2e):
count = count+1
print count
if count >= 2:
print("removing element")
print l2e
list2.remove(l2e)
print"\tlist 2 is now"
print list2
print "LIST2 IS:"
print list2
print("-----")
def main():
n = 3
S = 'AABCAAADA'
splitToT(S, n)
if __name__ == "__main__":
main()