Advertisement
PecaJ

Petra dz4

Dec 21st, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. def unosReci():
  2. reci = input()
  3. reci = reci.split("-")
  4. for i in reci:
  5. if not i.isalnum():
  6. return []
  7. return reci
  8.  
  9. def obrada(reci):
  10. rezultat = ""
  11. for rec in reci:
  12. temp = ""
  13. mala_slova = []
  14. for i in rec:
  15. if i.isalpha() and i.islower():
  16. temp += i
  17. elif len(temp) != 0:
  18. mala_slova.append(temp)
  19. temp = ""
  20. if len(temp) != 0:
  21. mala_slova.append(temp)
  22. if len(mala_slova) != 0:
  23. maks = mala_slova[0]
  24. for i in mala_slova:
  25. if len(i) >= len(maks):
  26. maks = i
  27. rezultat += maks
  28. return rezultat
  29.  
  30. reci = unosReci()
  31. rezultat = obrada(reci)
  32. print(rezultat, end="")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement