Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def najdaljsaBeseda(niz):
- text=niz
- zacetek=0
- konec=0
- seznamBesed=[]
- locila=["." , "," , "!" , "?" , " "]
- for i in range(len(text)):
- if(text[i] in locila):
- podtext=text[zacetek:konec]
- zacetek=konec+1
- konec=zacetek
- seznamBesed.append(podtext)
- else:
- konec+=1
- maksi=-9999
- p=[]
- for i in range(len(seznamBesed)):
- if(seznamBesed[i] not in p):
- st=0
- for j in range(len(seznamBesed)):
- if(seznamBesed[i]==seznamBesed[j]):
- st+=1
- if(st>maksi):
- maksi=st
- index=i
- p.append(seznamBesed[i])
- print(seznamBesed[index])
- najdaljsaBeseda("a AA GH GH GG GG g g g g g g.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement