battle-of-words

Alice and Bob are fighting over who is a superior debater. However they wish to decide this in a dignified manner. 
So they decide to fight in the Battle of Words. 

In each game both get to speak a sentence. Because this is a dignified battle, they do not fight physically, the alphabets in their words do so for them. Whenever an alphabet spoken by one finds a match (same alphabet) spoken by the other, they kill each other. These alphabets fight till the last man standing.

A person wins if he has some alphabets alive while the other does not have any alphabet left.

Alice is worried about the outcome of this fight. She wants your help to evaluate the result. So kindly tell her if she wins, loses or draws.

Input:
First line contains an integer T denoting the number of games played.
Each test case consists of two lines. First line of each test case contains a string spoken by Alice. 
Second line of each test case contains a string spoken by Bob.

Note:
Each sentence can have multiple words but the size of sentence shall not exceed 10^5.

Output:
For each game, output consists of one line each containing "You win some." if she wins ,"You lose some." if she loses or "You draw some." otherwise.

Constraints:

1 ≤ T ≤ 10
1≤ |A|,| B| ≤ 10^5
'a' ≤ alphabet ≤ 'z'
Each string contains atleast one alphabet.

Scoring:

Length of |A|,|B| in each test case does not exceed 10^4 : ( 30 pts )
Original Constraints : ( 70 pts )

SAMPLE INPUT
3
i will win
will i
today or tomorrow
today or tomorrow and yesterday
i dare you
bad day

SAMPLE OUTPUT
You win some.
You lose some.
You draw some.

Explanation

Case 1: Alice has "win" left at the end. So she wins.
Case 2: Bob has "andyesterday" left at the end. So Alice loses.
Case 3: Alice has "ireou" and Bob has "bda" left. So Draw.

Difficulty: EASY
Tags: Fundamentals

Ad-hoc

Starter code:

Solutions:
from collections import Counter
t=int(input())
while t:
	a=list(input())
	a=[x for x in a if x != " "]
	b=list(input())
	b=[x for x in b if x != " "]
	c1 = Counter(a)
	c2 = Counter(b)
	diff1 = c1-c2
	diff2=c2-c1
	if(len(list(diff1))>0 and len(list(diff2))==0):
		print("You win some.")
	elif(len(list(diff1))==0 and len(list(diff2))>0):
		print("You lose some.")
	else:
		print("You draw some.")
	t=t-1
		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import string

test = int(input())

for t in range(test):
	alice = input()
	bob = input()
	
	alice_dic = dict.fromkeys(string.ascii_lowercase, 0)
	bob_dic = dict.fromkeys(string.ascii_lowercase, 0)
	
	for i in alice:
		if i in string.ascii_lowercase:
			alice_dic[i] += 1
	
	for j in bob:
		if j in string.ascii_lowercase:
			bob_dic[j] += 1

	sum_alice = 0
	sum_bob = 0
	
	for k in string.ascii_lowercase:
		if alice_dic[k] >= bob_dic[k]:
			alice_dic[k] -= bob_dic[k]
			if bob_dic[k] != 0:
				bob_dic[k] = 0
		else:
			bob_dic[k] -= alice_dic[k]
			if alice_dic[k] != 0:
				alice_dic[k] = 0
		
		sum_alice += alice_dic[k]
		sum_bob += bob_dic[k]
	
	if sum_alice > sum_bob and sum_bob == 0:
		print("You win some.")
	elif sum_alice < sum_bob and sum_alice == 0:
		print("You lose some.")
	else:
		print("You draw some.")
	
	


for _ in range(int(input())):
	arr1 = input()
	arr2 = input()
	n1 = len(arr1)
	n2 = len(arr2)
	dic1 = [0]*26
	dic2 = [0]*26
	for i in range(n1):
		if arr1[i] != " ":
			dic1[ord(arr1[i])-ord('a')] += 1
	for i in range(n2):
		if arr2[i] != " ":
			dic2[ord(arr2[i])-ord('a')] += 1
		
	flag1 = 0
	flag2 = 0
	for i in range(26):
		if dic1[i] > dic2[i]:
			flag1 = 1
		elif dic1[i] < dic2[i]:
			flag2 = 1
	if flag1 and flag2:
		print("You draw some.")
	elif flag1 and not flag2:
		print("You win some.")
	elif not flag1 and flag2:
		print("You lose some.")
		
	
		
	


for t in range(eval(input())):
	a = input()
	b = input()
	a_ary = [0]*26
	b_ary = [0]*26
	for i in a:
		if ord(i) != 32:
			a_ary[ord(i)-97] += 1
	for i in b:
		if ord(i) != 32:
			b_ary[ord(i)-97] += 1

	for i in range(26):
		if a_ary[i]>0 and b_ary[i]>0:
			a_ary[i], b_ary[i] = a_ary[i]-b_ary[i],b_ary[i]-a_ary[i]
			if a_ary[i]<0 : a_ary[i] = 0
			if b_ary[i]<0 : b_ary[i] = 0

	alice = bob = 0
	for i in range(26):
		if a_ary[i] > 0:
			alice += 1
		if b_ary[i] > 0:
			bob += 1
	if alice > 0 and bob == 0:
		print("You win some.")
	elif alice == 0 and bob > 0:
		print("You lose some.")
	else:
		print("You draw some.")


t = eval(input(' '))
ans = []
for p in range(0,26):
	ans.append(0)
for i in range(0,t):
	a = input()
	b = input()
	for p in range(0,26):
		ans[p] = 0
	for m in a:
		if m == ' ':
			continue
		s = ord(m) - ord('a')
		ans[s] += 1
	   # print ans[s]
	for m in b:
		if m == ' ':
			continue
		s = ord(m) - ord('a')
		ans[s] -= 1
	flag = 0
	r = 0
	for p in range(0,26):
	   # print ans[p]
		if ans[p] > 0:
			if flag == -1:
			   # print p
				print("You draw some.")
				r = 1
				break
			else:
				flag = 1
		elif ans[p] < 0:
			if flag == 1:
				print("You draw some.")
				r = 1
				break
			else:
				flag = -1
	if r== 0:
		if flag == 1:
			print("You win some.")
		elif flag == -1:
			print("You lose some.")
		else:
		   # print flag
			print("You draw some.")
	
			
		
		
	


import sys

def compare(s1,s2):
	s1=s1.replace(" ","")
	s2=s2.replace(" ","")
	tracker=[0]*26
	for i in s1:
		tracker[ord(i)-97]+=1
	for i in s2:
		tracker[ord(i)-97]-=1
	draw=1
	alice=0
	bob=0
	for i in tracker:
		if i!=0:
			draw=0
		if i>0:
			alice=1
		if i<0:
			bob=1
	if alice>0 and bob==0:
		return "You win some."
	elif alice==0 and bob>0:
		return "You lose some."
	else:
		return "You draw some."
			

data=sys.stdin.readlines()
data[-1]=data[-1]+'\n'
data=[i[:-1] for i in data]
n=int(data[0])
for i in range(n):
	print(compare( data[2*(i+1)-1] , data[2*(i+1)]  ))


test = int(input())

def count_occu(d,word):
	for i in word:
		if i not in list(d.keys()):
			d[i] = 1
		else:
			d[i] += 1
	return d

def check_occu(p,q):
	count = 0
	for i in list(p.keys()):
		if i not in list(q.keys()):
			pass
		elif p[i] >= q[i]:
			count += 1
	if count == len(list(q.keys())):
		return 1
	else:
		return 0

for i in range(test):
	w1 = input().replace(" ","")
	w2 = input().replace(" ","")
	d1 = count_occu({},w1)
	d2 = count_occu({},w2)	
	j = check_occu(d1,d2)
	k = check_occu(d2,d1)
	
	if j == 1 and k == 1:
		print("You draw some.")
	elif j == 1 and k == 0:
		print("You win some.")
	elif k == 1 and j == 0:
		print("You lose some.")
	else:
		print("You draw some.")


from collections import Counter as mset
for _ in range(eval(input())):
	astr = input()
	bstr = input()
	a = mset("".join(astr.split()))
	b = mset("".join(bstr.split()))
	c = a & b
	la = len(a - c)
	lb = len(b - c)
	
	if (la ==0 and lb ==0) or (la > 0 and lb > 0):
		print("You draw some.")
	elif la==0 and lb > 0:
		print("You lose some.")
	else:
		print("You win some.")


def take_input():
	no_of_test_cases = int(input())
	battles = []
	for test_case in range(no_of_test_cases):
		alice_words = input()
		bob_words = input()
		battles.append([alice_words, bob_words])
	return battles

def traverse_and_kill(bigger_list, smaller_list):
	smaller_index = 0
	bigger_index = 0
	while(1):
		try:
			if smaller_list[smaller_index] > bigger_list[bigger_index]:
				bigger_index += 1
			elif smaller_list[smaller_index] == bigger_list[bigger_index]:
				smaller_list[smaller_index] = ' '
				bigger_list[bigger_index] = ' '
				smaller_index += 1
				bigger_index += 1
			else:
				smaller_index += 1
		except IndexError:
			break

def get_winner(battle):
	alice_words = [x for x in list(battle[0]) if (False if x == ' ' else True)]
	bob_words = [x for x in list(battle[1]) if (False if x == ' ' else True)]
	alice_words.sort()
	bob_words.sort()
	
	if len(alice_words) > len(bob_words):
		traverse_and_kill(alice_words, bob_words)
	else:
		traverse_and_kill(bob_words, alice_words)
	
	alice_words = [x for x in alice_words if (False if x == ' ' else True)]
	bob_words = [x for x in bob_words if (False if x == ' ' else True)]
	
	if len(alice_words) > 0 and len(bob_words) == 0:
		return 'You win some.'
	elif len(bob_words) > 0 and len(alice_words) == 0:
		return 'You lose some.'
	else:
		return 'You draw some.'
	

if __name__ == '__main__':
	battles = take_input()
	for battle in battles:
		print(get_winner(battle))


t=eval(input())
while t:
	t-=1
	al=[0]*26
	bob=[0]*26
	a=input()
	for x in a:
		if (x!=' '):
			al[ord(x)-ord('a')]+=1
	a=input()
	for x in a:
		if (x!=' '):
			bob[ord(x)-ord('a')]+=1
	a=0
	b=0
	for x in range(26):
		if (al[x]>bob[x]):
			a+=al[x]-bob[x]
		else:
			b+=bob[x]-al[x]
	if (a==0):
		if (b==0):
			print("You draw some.")
		else:
			print("You lose some.")
	elif (b==0):
		if (a==0):
			print("You draw some.")
		else:
			print("You win some.")
	else:
		print("You draw some.")


t=list(map(int,input().split()))[0]


while(t > 0):

	wA = list(map(str,input().split()))
	wB = list(map(str,input().split()))
	dica = {}

	for w in wA:
		for c in w:
			dica[c] = dica.get(c, 0) + 1

	for w in wB:
		for c in w:
			dica[c] = dica.get(c, 0) - 1
	sumA = 0
	sumB = 0
	for k in dica:
		if dica[k] > 0:
			sumA+=dica[k]
		if dica[k] < 0:
			sumB+=(-1*dica[k])
	if sumB == 0 and sumA > 0:
		print('You win some.')
	elif sumA == 0 and sumB > 0:
		print('You lose some.')
	else:
		print('You draw some.')
	t-=1




import sys,math
for x in range(0,eval(input())):
	al=input()
	bob=input()
	a=[]
	b=[]
	for i in range(0,27):
		a.append(0)
		b.append(0)
	for c in al:
		if c!=' ':
			a[ord(c)-96]+=1
	for c in bob:
		if c!=' ':
			b[ord(c)-96]+=1
	for i in range(27):
		if a[i]>=b[i]:
			a[i]=a[i]-b[i]
			b[i]=0
		else:
			b[i]=b[i]-a[i]
			a[i]=0
	acnt=0
	bcnt=0
	for c in a:
		if c>0:
			acnt+=1
	for c in b:
		if c>0:
			bcnt+=1
	if(acnt!=0 and bcnt!=0) or (acnt==bcnt):
		print('You draw some.')
	elif(acnt>0 and bcnt==0):
		print('You win some.')
	elif(acnt==0 and bcnt>0):
		print('You lose some.')    
		
	#print a
	#print b
	


def count(a):
	p=0
	for i in range(len(a)):
		if(a[i]!=0):
			p+=1
	return p
t=eval(input())
for test in range(t):
	a=input()
	b=input()
	ac=[0 for i in range(26)]
	bc=[0 for i in range(26)]
	for i in range(len(a)):
		if(ord(a[i])>=ord('a') and ord(a[i])<=ord('z')):
			ac[ord(a[i])-ord('a')]+=1
	for i in range(len(b)):
		if(ord(b[i])>=ord('a') and ord(b[i])<=ord('z')):
			bc[ord(b[i])-ord('a')]+=1
	for i in range(26):
		x=min(ac[i],bc[i])
		ac[i]-=x
		bc[i]-=x
	r=count(ac)
	s=count(bc)
	if(r!=0 and s==0):
		print("You win some.")
	elif (r==0 and s!=0):
		print("You lose some.")
	else:
		print("You draw some.")



test = int(input())

while(test):
	
	test -= 1
	
	alice = input()
	
	bob = input()
	
	al = len(alice)
	bl = len(bob)
	a = al
	b = bl
	cal = []
	bal = []
	for i in range(0,25):
		cal.append(alice.count(chr(97+i)))
		bal.append(bob.count(chr(97+i)))
	for i in range(0,25):
		if(cal[i] >= bal[i]):
			cal[i] = cal[i]-bal[i]
			bal[i] = 0
		else:
			bal[i] = bal[i] - cal[i]
			cal[i] = 0
			
	a = sum(cal)
	b = sum(bal)
	#print a,b
	if(a>0 and b <= 0):
		print("You win some.")
	elif(b>0 and a <= 0):
		print("You lose some.")
	else:
		print("You draw some.")
		
		
		
'''
	for i in range(0,a):
		aset.append(alice[i])
#	print aset
	aset.sort()
	bset = []
	for j in range(0,b):
		bset.append(bob[j])
#	print bset
	bset.sort()
	'''


for i in range(int(input())):
	s1 = input().split()
	s2 = input().split()
	i = [0]*26
	for j in s1:
		for k in j:
			i[ord(k)-ord('a')]+=1
	for j in s2:
		for k in j:
			i[ord(k)-ord('a')]-=1
	count1=0
	count2=0
	for j in range(26):
		if(i[j]<0):
			count2+=1
		elif(i[j]>0):
			count1+=1
	if count1!=0 and count2==0:
		print('You win some.')
	elif count1==0 and count2!=0:
		print('You lose some.')
	else:
		print('You draw some.')
	
	


T = int(input())
def solve(A,B):
	x = [0]*26
	y = [0]*26
	for i in A:
		if(ord(i)<97 or ord(i)>122):
			continue
		x[ord(i)-97] += 1
	for i in B:
		if(ord(i)<97 or ord(i)>122):
			continue
		y[ord(i)-97] += 1
	for i in range(26):
		a = min(x[i],y[i])
		x[i] -= a
		y[i] -= a
	xx = sum(x)
	yy = sum(y)
	#print x
	#print y
	if(xx > 0):
		if(yy==0):
			return "You win some."
		else:
			return "You draw some."
	else:
		if(yy>0):
			return "You lose some."
		else:
			return "You draw some."
	
		
for _ in range(T):
	A = input()
	B = input()
	print(solve(A,B))


t=eval(input());
while t!=0:
	t=t-1;
	a=input();	
	b=input();	
	al=[];
	bo=[];
	for i in range(0, 30):	
		al.append(0);
		bo.append(0);
	for i in range(0, len(a)):
		if(a[i] != ' '):
			al[ord(a[i])-97]=al[ord(a[i])-97]+1;
	for i in range(0, len(b)):
		if(b[i] != ' '):
                        bo[ord(b[i])-97]=bo[ord(b[i])-97]+1;
	w=0;
	l=0;
	
	for i in range(0, 26):
		if(al[i]>bo[i]):
			w=1;
		elif(al[i]<bo[i]):
			l=1;
	
	if(w == 0 and l == 0):
		print('You draw some.');
	elif(w == 0 and l == 1):
		print('You lose some.');
	elif(w == 1 and l == 0):
		print('You win some.');
	elif(w == 1 and l == 1):
		print('You draw some.');


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
for kappa in range(t):
	alice = input()
	bob = input()
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	alicel = []
	bobl = []
	for letter in alpha:
		alicel.append(alice.count(letter))
		bobl.append(bob.count(letter))
	lst = []    
	for i in range(26):
		diff = alicel[i]-bobl[i]
		lst.append(diff)
	if max(lst)>0 and min(lst)>=0:
		print('You win some.')
	elif max(lst)<=0 and min(lst)<0:
		print('You lose some.')
	else:
		print('You draw some.')


from string import ascii_lowercase as lc
indx = [0] * 26
dicts = dict(list(zip(lc, indx)))

for _ in range(eval(input())):
	sheDict = dict(list(zip(lc, indx)))
	heDict  = dict(list(zip(lc, indx)))    
	sheStr = input().strip()
	for x in sheStr:
		if x != " ":
			sheDict[x] +=1
	heStr  = input().strip()
	for x in heStr:
		if x != " ":
			heDict[x] += 1
		
	p , n = 0, 0
	for i in range(len(lc)):
		tmp = sheDict[lc[i]] - heDict[lc[i]]
		if tmp > 0 : p = 1
		if tmp < 0 : n = 1
	if n ^ p == 0:
		print("You draw some.")
	elif p == 1:
		print("You win some.")
	else:
		print("You lose some.")

		
		
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
while t:
	a = input()
	b = input()
	l = [0]*26
	pos = False
	neg = False
	for i in a:
		if i==' ':
			continue
		l[ord(i)-ord('a')] += 1
	for i in b:
		if i==' ':
			continue
		idx = ord(i)-ord('a')
		l[idx] -= 1
	for idx in range(26):
		if l[idx] > 0:
			pos = True
		if l[idx] < 0:
			neg = True
	if pos and not neg:
		print("You win some.")
	elif not pos and neg:
		print("You lose some.")
	else:
		print("You draw some.")
	t-=1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'


import collections
num_of_cases = int(input())
alice_string = ""
bob_string = ""

for case in range(num_of_cases):
	alice_string = input().replace(" ","")
	bob_string = input().replace(" ","")
	alice_string_length = len(alice_string)
	bob_string_length = len(bob_string)
	alice_set = collections.Counter(alice_string)
	bob_set = collections.Counter(bob_string)
	#print alice_set
	#print bob_set
	#print common_characters
	alice_string_length = len(alice_string)
	bob_string_length = len(bob_string)
	
	common_characters = alice_set & bob_set
	#print  common_characters
	#print bob_set
	if alice_string_length < bob_string_length:
		if alice_set == common_characters:
			print("You lose some.")
		else:
			print("You draw some.")
	else:
		if bob_set == common_characters:
			print("You win some.")
		else:
			print("You draw some.")
			
	'''		
			
	if alice_string_length < bob_string_length:
		for c in bob_string:
			if alice_string.find(c)!=-1:
				alice_string = alice_string.replace(c,"",1)
			if alice_string == "":
				print "You lose some."
				break
		if alice_string!="":
			print "You draw some."
	else:
		for c in alice_string:
			if bob_string.find(c)!=-1:
				bob_string = bob_string.replace(c,"",1)
			if bob_string == "":
				print "You win some."
				break
		if bob_string!="":
			print "You draw some."
			
	
	'''

	
	#common_words = alice_list & bob_list
	#print common_words


t = int(input())
for i in range(t):
	a = input()
	b = input()
	c = []
	d = []
	for i in range(256):
		c.append(0)
		d.append(0)
	
	for i in range(len(a)):
		if a[i]==' ':
			continue
		c[ord(a[i])]+=1
	
	for i in range(len(b)):
		if b[i] == ' ':
			continue
		if c[ord(b[i])] > 0:
			c[ord(b[i])]-=1
		else:
			d[ord(b[i])]+=1
		
	fa = False
	fb = False
	for i in range(256):
		if c[i]>0:
			fa = True
		if d[i]>0:
			fb = True
	
	if fa==True and fb==True:
		print("You draw some.")
	elif fa==True:
		print("You win some.")
	else:
		print("You lose some.")
	#t-=1


t = eval(input())
for i in range(t):
	al  = input()
	bob = input()
	a_has = [0] * 26
	b_has = [0] * 26
	for x in al:
		if(x==' '):
			continue
		a_has[ord(x)-97]+=1
	for x in bob:
		if(x==' '):
			continue
		b_has[ord(x)-97]+=1
	for j in range(0,26):
		xy = min(a_has[j],b_has[j])
		a_has[j]-=xy
		b_has[j]-=xy
	isb = True
	isa = True
	for x in a_has:
		if(x!=0):
			isa=False
	for x in b_has:
		if(x!=0):
			isb=False
	if(isa==False and isb == False):
		print("You draw some.")
	elif(isb==False):
		print("You lose some.")
	else:
		print("You win some.")


def makeFreq(s):
	f = {}
	for c in s:
		if c not in f: f[c] = 0
		f[c] += 1
	return f
			
def positiveLength(f):
	for v in f.values():
		if v > 0: return True
	return False

for _ in range(eval(input())):
	alice = ''.join(input().split())
	bob = ''.join(input().split())
	t = makeFreq(alice)
	for c in bob: 
		if c in t: t[c] -= 1
	ares = positiveLength(t)
	t = makeFreq(bob)
	for c in alice: 
		if c in t: t[c] -= 1
	bres = positiveLength(t)
	if ares and bres:
		print('You draw some.')
	if ares and not bres:
		print('You win some.')
	if not ares and bres:
		print('You lose some.')
	if not ares and not bres:
		print('You draw some.')


n = eval(input())
while n!=0:
	r = input()
	r2 = input()
	d={}
	for i in r:
		if ord(i) in list(d.keys()):
			d[ord(i)]+=1
		else: 
		 	d[ord(i)]=1
	for i in r2:
	  	if ord(i) in list(d.keys()):
			d[ord(i)]-=1
		else:
		 	d[ord(i)]=-1
	fl1=0
	fl2=0
	for i in range(97,123):
		if i in list(d.keys()):
			if d[i]<0:
				fl2=1
			elif d[i]>0:
				fl1=1
	if (fl1==0 and fl2==0) or (fl1==1 and fl2==1):
		print("You draw some.")
	elif fl2==0:
	 	print("You win some.")
	else:
	 	print("You lose some.")
	n-=1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=int(input())
while(t):
	t-=1
	s1=input()
	s2=input()
	c1=[]
	c2=[]
	for i in range(27):
		c1.append(0)
		c2.append(0)
	#print(c)
	for i in range(len(s1)):
		if(s1[i]==' '):
			c1[26]+=1
		else:
			c1[ord(s1[i])-97]+=1
	for i in range(len(s2)):
		if(s2[i]==' '):
			c2[26]+=1
		else:
			c2[ord(s2[i])-97]+=1
	#print(c1)
	#print(c2)
	one=0
	two=0
	for i in range(26):
		if(c1[i]>c2[i]):
			one=1
		elif(c1[i]<c2[i]):
			two=1
	if(one==1 and two==1):
		print("You draw some.")
	elif(one==1):
		print("You win some.")
	else:
		print("You lose some.")


# /he/April/2015/Easy/WORDS

n_tests = eval(input())
for tc in range(n_tests):
	alice = input()
	bob = input()

	alicemap = [0] * 26
	bobmap = [0] * 26

	for ch in alice:
		if ord(ch) >= ord('a') and ord(ch) <= ord('z'):
			alicemap[ord(ch) - ord('a')] += 1
	for ch in bob:
		if ord(ch) >= ord('a') and ord(ch) <= ord('z'):
			bobmap[ord(ch) - ord('a')] += 1

	for i in range(26):
		val = min(alicemap[i], bobmap[i])
		alicemap[i] -= val
		bobmap[i] -= val
	
	if sum(alicemap) > 0 and sum(bobmap) == 0:
		print('You win some.')
	elif sum(bobmap) > 0 and sum(alicemap) == 0:
		print('You lose some.')
	else:
		print('You draw some.')