text: # Problem This is a simple game you must have played around with during your school days, calculating FLAMES of you and your crush!Given the names of two people, cancel out the common letters (repeated occurrence of a letter is treated separately, so 2A's in one name and one A in the other would cancel one A in each name), count the total number of remaining letters (n) and repeatedly cut the letter in the word FLAMES which hits at the nth number when we count from F in cyclic manner.For example: NAME 1: SHILPA NAME 2: AAMIR After cutting the common letters: NAME 1: SHILPA NAME 2: AAMIR Total number of letters left=7 FLAMES, start counting from F : 1=F, 2=L, 3=A, 4=M, 5=E, 6=S,7=F...So cut F FLAMES: repeat this process with remaining letters of FLAMES for number 7 (start count from the letter after the last letter cut) .In the end, one letter remains.Print the result corresponding to the last letter: F=FRIENDS L=LOVE A=ADORE M=MARRIAGE E=ENEMIES S=SISTER Input The no.of test cases ( Output FLAMES result (Friends/Love/...etc) for each test case Example Input: 2 SHILPA AAMIR MATT DENISE Output: ENEMIES LOVE By: Chintan, Asad, Ashayam, Akanksha # Solution testcase = raw_input(); tc = int(testcase) while (tc > 0): flames = "FLAMES" #flames[0] = 'X' name1=list((raw_input()).replace(' ','')) name2=list((raw_input()).replace(' ','')) #ht = {} count =0 count1 = 0 i=0 while(i < len(name1)): j=0 while(j < len(name2)): if(name1[i] == name2[j]): name2[j] = '0' name1[i] = '0' break j +=1 i += 1 name1 = "".join(name1) name2 = "".join(name2) joined = str(name1+name2).replace('0','') count = len(joined) """while( i < len(joined)): if ht.has_key(joined[i]): ht[joined[i]] = ht[joined[i]] + 1 else: ht[joined[i]] = 1 i += 1 count = 0 for key in ht: ht[key] %= 2 count += ht[key]""" letters=6 while(len(flames) != 1): index = count % letters if(index == 0): flames=flames.replace(flames[len(flames)-1],"") else: flames=flames.