You know how sometimes you write the the same word twice in a sentence, but then don't notice that it happened? For example, you've been distracted for a second. Did you notice that *"the"* is doubled in the first sentence of this description?

As as aS you can see, it's not easy to spot those errors, especially if words differ in case, like *"as"* at the beginning of the sentence.

Write a function that counts the number of sections repeating the same word (case insensitive). The occurence of two or more equal words next after each other count as one.

**Example:**
```
"dog cat"                 --> 0
"dog DOG cat"             --> 1
"apple dog cat"           --> 0
"pineapple apple dog cat" --> 0
"apple     apple dog cat" --> 1
"apple dog apple dog cat" --> 0
"dog dog DOG dog dog dog" --> 1
"dog dog dog dog cat cat" --> 2
"cat cat dog dog cat cat" --> 3
```

Difficulty: introductory

Starter code:

def count_adjacent_pairs(st):
	

Solutions:
def count_adjacent_pairs(st): 
    words = st.lower().split(' ')
    currentWord = None
    count = 0
    for i, word in enumerate(words):
        if i+1 < len(words):
            if word == words[i+1]:
                if word != currentWord:
                    currentWord = word
                    count += 1
            else:
                currentWord = None
          
    return count

from itertools import groupby
def count_adjacent_pairs(st): 
    return len([name for name,group in groupby(st.lower().split(' ')) if len(list(group))>=2])

import re
def count_adjacent_pairs(s): 
    return len(re.findall(r'(\b.+\b)\1+',s+' ', re.I))

from itertools import groupby

def count_adjacent_pairs(s):
    return sum(next(y) == next(y, 0) for x, y in groupby(s.lower().split()))

def count_adjacent_pairs(st): 
    s, one, two, c = st.lower().split(' '), None, None, 0
    for w in s:
        c += w == one and w != two
        two = one
        one = w
    return c

def count_adjacent_pairs(st): 
    st = st.lower().split()
    check, ret, k = None, 0, 0
    for e in st:
        if e == check and k:
            continue
        if e == check and not k:
            ret, k = ret + 1, 1
        else:
            check,k = e, 0
    return ret

import re;count_adjacent_pairs=lambda s:len(re.findall(r'(\b\w+)(\s+\1)+',s,re.I))

from itertools import groupby


def count_adjacent_pairs(stg): 
    return sum(1 for _, g in groupby(stg.lower().split()) if len(list(g)) > 1)

def count_adjacent_pairs(st):
    if not st:
        return 0
    res = 0
    arr = [i.lower() for i in st.split()]
    for i in range(len(arr)-1):
        if i == 0:
            if arr[i] == arr[i+1]:
                res += 1
        elif arr[i] == arr[i+1] != arr[i-1]:
            res += 1
    return res

def count_adjacent_pairs(st):
    #print(st)
    st = st.lower().split()
    cnt = 0
    on = False
    for i in range(1,len(st)):
        if st[i] == st[i-1]:
            if not on: 
                cnt += 1
                on = True
        else:
            on = False
    return cnt