10887 - Concatenation of Languages Solution Python
totalCase = int ( input ()) i = 1 while i <= totalCase: m, n = [ int (x) for x in input ().split()] mySet1 = set () for j in range (m): mySet1.add( input ().strip()) mySet2 = set () for j in range (n): mySet2.add( input ().strip()) mySet = set () for x in mySet1: for y in mySet2: mySet.add(x + y) print ( f"Case { i } : { len (mySet) } " ) i += 1