Beaches are filled with sand, water, fish, and sun. Given a string, calculate how many times the words `"Sand"`, `"Water"`, `"Fish"`, and `"Sun"` appear without overlapping (regardless of the case).

## Examples

```python
sum_of_a_beach("WAtErSlIde")                    ==>  1
sum_of_a_beach("GolDeNSanDyWateRyBeaChSuNN")    ==>  3
sum_of_a_beach("gOfIshsunesunFiSh")             ==>  4
sum_of_a_beach("cItYTowNcARShoW")               ==>  0
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def sum_of_a_beach(beach):
	

Solutions:
import re

def sum_of_a_beach(beach):
	return len(re.findall('Sand|Water|Fish|Sun', beach, re.IGNORECASE))


def sum_of_a_beach(beach):
	return sum((beach.lower().count(fun) for fun in ['sand', 'water', 'fish', 'sun']))


import re

def sum_of_a_beach(beach):
	return len(re.findall('sand|water|fish|sun', beach, flags=re.I))


import re

def sum_of_a_beach(beach):
	return sum((1 for _ in re.finditer('sand|water|fish|sun', beach.lower())))


def sum_of_a_beach(beach):
	b = beach.lower()
	l = ['sand', 'water', 'fish', 'sun']
	c = 0
	for w in l:
		if w in b:
			c += b.count(w)
	return c


sum_of_a_beach = lambda s: sum((s.lower().count(e) for e in ['sand', 'water', 'fish', 'sun']))


def sum_of_a_beach(beach):
	words = ['Sand', 'Water', 'Fish', 'Sun']
	count = 0
	for word in words:
		length = len(word)
		for i in range(len(beach)):
			if beach[i:length + i].lower() == word.lower():
				count += 1
	return count


sum_of_a_beach = lambda beach: beach.lower().count('water') + beach.lower().count('sand') + beach.lower().count('fish') + beach.lower().count('sun')