Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Common Words by adeq
def checkio(first, second):
a=first.replace(","," ")
b=a.split()
c=second.replace(","," ")
d=c.split()
e=len(b)
f=len(d)
y=True #chce sprawdizc sobie ktora lista krotsza bedzie zeby zrobic czy wyrazy z krotszego sa w dluzszym
max=0 #chociaz jak sobie teraz mysle to nie wiem po co bo to nie ma znaczenia
odp=""
if e > f:
max=e
y=True
else:
max=f
y=False
for i in range(max):
if y==True: #czyli jak e jest wieksze
if b[i] in d:
odp=odp+b[i]+","
if y==False:
if d[i] in b:
odp=odp+d[i]+","
odp=odp[:-1]
o=odp.replace(","," ")
p=o.split()
p.sort() #najgorszy program w his
odp1=""
print(p)
for i in range(len(p)):
odp1=odp1+p[i]+","
print(odp1)
odp1=odp1[:-1]
return(odp1)
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
assert checkio("hello,world", "hello,earth") == "hello", "Hello"
assert checkio("one,two,three", "four,five,six") == "", "Too different"
assert checkio("one,two,three", "four,five,one,two,six,three") == "one,three,two", "1 2 3"
Nov. 8, 2018