Kate likes to count words in text blocks. By words she means continuous sequences of English alphabetic characters (from a to z ). Here are examples:

`Hello there, little user5453 374 ())$. I’d been using my sphere as a stool. Slow-moving target 839342 was hit by OMGd-63 or K4mp.` contains "words" `['Hello', 'there', 'little', 'user', 'I', 'd', 'been', 'using', 'my','sphere', 'as', 'a', 'stool', 'Slow', 'moving', 'target', 'was', 'hit', 'by', 'OMGd', 'or', 'K', 'mp']`

Kate doesn't like some of words and doesn't count them. Words to be excluded are "a", "the", "on", "at", "of", "upon", "in" and "as", case-insensitive.

Today Kate's too lazy and have decided to teach her computer to count "words" for her.


Example Input 1
-------------
Hello there, little user5453 374 ())$.

Example Output 1
-------------
4

Example Input 2
-------------

  I’d been using my sphere as a stool. I traced counterclockwise circles on it with my fingertips and it shrank until I could palm it. My bolt had shifted while I’d been sitting. I pulled it up and yanked the pleats straight as I careered around tables, chairs, globes, and slow-moving fraas. I passed under a stone arch into the Scriptorium. The place smelled richly of ink. Maybe it was because an ancient fraa and his two fids were copying out books there. But I wondered how long it would take to stop smelling that way if no one ever used it at all; a lot of ink had been spent there, and the wet smell of it must be deep into everything.

Example Output 2
--------------

112

Difficulty: EASY
Starter code: def word_count(s):
	

Solutions:
from re import compile, finditer
OMIT = {'a', 'the', 'on', 'at', 'of', 'upon', 'in', 'as'}
REGEX = compile('[a-z]+')

def word_count(s):
	return sum((a.group() not in OMIT for a in finditer(REGEX, s.lower())))


def word_count(s):
	return sum((1 for w in ''.join((c if c.isalpha() else ' ' for c in s.lower())).split() if w not in ['a', 'the', 'on', 'at', 'of', 'upon', 'in', 'as']))


from re import sub

def word_count(s):
	alpha = sub('(^|\\s)(a|the|on|at|of|in|as)(?=(\\s|$))', ' ', sub('[^a-z]', ' ', s.lower().replace('æ', 'ae')))
	return len(alpha.split())


from re import split

def word_count(s):
	return len([w for w in split('[^a-z]+', s.lower()) if not w in ['a', 'the', 'on', 'at', 'of', 'upon', 'in', 'as', '']])


import re

def word_count(s):
	words = re.findall('[a-z]+', s, re.I)
	return sum((not re.match('(a|the|on|at|of|upon|in|as)$', w, re.I) for w in words))


import re
excluded = re.compile('\\b(a[ts]?|the|o[nf]|upon|in)\\b')
non_char = re.compile('[^a-z]+')

def word_count(s):
	return len(re.sub(excluded, '', re.sub(non_char, ' ', s.lower())).split())


import re
from collections import Counter
EXCLUDE = {'a', 'the', 'on', 'at', 'of', 'upon', 'in', 'as'}

def word_count(s):
	return sum((v for (k, v) in Counter(re.findall('(?i)[a-z]+', s.lower())).items() if k not in EXCLUDE))


import re
FORBIDDENS = set('a the on at of upon in as'.split())

def word_count(s):
	return sum((m[0] not in FORBIDDENS for m in re.finditer('[a-z]+', s.lower())))