C. The Smallest String Concatenation https://codeforces.com/problemset/problem/632/C

for this problem i have wite a code in python
and testcase 1 is not passing can i get what is my error

my code is :

def comparator(s1,s2) :
for i in range(len(s1) if len(s1)< len(s2) else len(s2)) :
if s1[i] > s2[i] :
return True
elif s[i] < s2[i] :
return False
if len(s1) > len(s2) :
return False
else :
return True

def bubble_sort(s,n) :
flag = True
while flag :
flag = False
for i in range(n-1) :
if comparator(s[i],s[i+1]) :
s[i],s[i+1] = s[i+1],s[i]
flag = True
return s

n = int(input())
s = []
for i in range(n) :
s.append(str(input()))
res = ‘’
for i in bubble_sort(s,n) :
res+=i
print(res)

https://drive.google.com/open?id=16dpF-kuxj2uitQd-P8oA_kKmR6ffdOafzuILlFH1qqs link of the code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.