Implement a function which behaves like the uniq command in UNIX.

It takes as input a sequence and returns a sequence in which all duplicate elements following each other have been reduced to one instance.

Example:

```
["a", "a", "b", "b", "c", "a", "b", "c"]  =>  ["a", "b", "c", "a", "b", "c"]
```

Difficulty: introductory

Starter code:

def uniq(seq):
	

Solutions:
from itertools import groupby

def uniq(seq): 
    return [k for k,_ in groupby(seq)]

def uniq(seq):
    if len(seq) == 0:
        return []
    rez = [seq[0]]
    for i in range(1, len(seq)):
        if seq[i] != rez[-1]:
            rez.append(seq[i])
    return rez

from itertools import groupby

def uniq(a):
    return [x for x, _ in groupby(a)]

def uniq(seq):
    return [c for i, c in enumerate(seq) if i == 0 or seq[i-1] != c]

def uniq(seq): 
    return ([seq[0]] + [seq[i] for i in range(1, len(seq)) if seq[i] != seq[i-1]] if seq else [])

def uniq(seq): 
    result = []
    for q in seq:
        if result and result[-1] == q:
            continue
        result.append(q)
    return result

def uniq(seq): 
    ans = []
    p   = ''
    for i in seq:
        if i != p:
            ans.append(i)
        p = i
    return ans if len(seq)>1 else seq

from itertools import groupby
from operator import itemgetter

# Just for fun, it's better to use list comprehension
def uniq(seq):
    return list(map(itemgetter(0), groupby(seq)))

from itertools import groupby
from operator import itemgetter

def uniq(seq):
    return list(map(itemgetter(0), groupby(seq)))

from itertools import groupby

def uniq(seq): 
    return [k[0] for k in groupby(seq)]