SimeonTs

SUPyF2 Basic Exercise More - 04. Sum Of A Beach

Sep 24th, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. """
  2. Basic Syntax, Conditional Statements and Loops - Exercise
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1720#3
  4. Video: https://www.youtube.com/watch?time_continue=4&v=7sHE4HEUqi8
  5.  
  6. SUPyF2 Basic Exercise More - 04. Sum Of A Beach
  7.  
  8. Problem:
  9. Beaches are filled with sand, water, fish, and sun. Given a string,
  10. calculate how many times the words "Sand", "Water", "Fish", and "Sun" appear (regardless of the case).
  11. Examples:
  12. Input:                          Output:
  13. WAtErSlIde                      1
  14. GolDeNSanDyWateRyBeaChSuNN      3
  15. gOfIshsunesunFiSh               4
  16. cItYTowNcARShoW                 0
  17. """
  18. text = input().lower()
  19.  
  20. counter = 0
  21.  
  22. counter += text.count("sand")
  23. counter += text.count("water")
  24. counter += text.count("fish")
  25. counter += text.count("sun")
  26.  
  27. print(counter)
Add Comment
Please, Sign In to add comment