# Story
Old MacDingle had a farm... 
...and on that farm he had
* horses 
* chickens 
* rabbits 
* some apple trees
* a vegetable patch
Everything is idylic in the MacDingle farmyard **unless somebody leaves the gates open**
Depending which gate was left open then...
* horses might run away
* horses might eat the apples
* horses might eat the vegetables
* chickens might run away
* rabbits might run away
* rabbits might eat the vegetables
# Kata Task
Given the state of the farm gates in the evening, your code must return what the farm looks like the next morning when daylight reveals what the animals got up to.
# Legend
* ```H``` horse
* ```C``` chicken
* ```R``` rabbit
* ```A``` apple tree
* ```V``` vegetables
* ```|``` gate (closed), 
* ```\``` or ```/``` gate (open)
* ```.``` everything else
# Example
Before
```|..HH....\AAAA\CC..|AAA/VVV/RRRR|CCC```
After
```|..HH....\....\CC..|AAA/.../RRRR|...```
Because:
The horses ate whatever apples they could get to
The rabbits ate the vegetables
The chickens ran away
# Notes
* If the animals can eat things *and* also run away then they do **BOTH** - it is best not to run away when you are hungry!
* An animal cannot "go around" a closed gate...
* ...but it is possible to run away from the farm and then **RUN BACK** and re-enter though more open gates on the other side!
def eating(field):
    if "H" in field:
        field = field.replace("A", ".")
        field = field.replace("V", ".")
    if "R" in field:
        field = field.replace("V", ".")
    return field


def runing(field):
    field = field.replace("H", ".")
    field = field.replace("C", ".")
    field = field.replace("R", ".")
    return field


def shut_the_gate(farm):

    splited = farm.split("|")
    splited = [eating(item) for item in splited]

    if not farm.startswith("|") and not farm.endswith("|"):

        if "H" in splited[0] or "H" in splited[-1]:
            splited[0] = splited[0].replace("A", ".")
            splited[0] = splited[0].replace("V", ".")
            splited[-1] = splited[-1].replace("A", ".")
            splited[-1] = splited[-1].replace("V", ".")

        if "R" in splited[0] or "R" in splited[-1]:
            splited[0] = splited[0].replace("V", ".")
            splited[-1] = splited[-1].replace("V", ".")

    if not farm.startswith("|"):
        splited[0] = runing(splited[0])

    if not farm.endswith("|"):
        splited[-1] = runing(splited[-1])

    return "|".join(splited)
def eating(field):
    if "H" in field:
        field = field.replace("A", ".")
        field = field.replace("V", ".")
    if "R" in field:
        field = field.replace("V", ".")
    return field


def runing(field):
    field = field.replace("H", ".")
    field = field.replace("C", ".")
    field = field.replace("R", ".")
    return field


def shut_the_gate(farm):

    splited = farm.split("|")
    splited = [eating(item) for item in splited]

    if not farm.startswith("|") and not farm.endswith("|"):

        if "H" in splited[0] or "H" in splited[-1]:
            splited[0] = splited[0].replace("A", ".")
            splited[0] = splited[0].replace("V", ".")
            splited[-1] = splited[-1].replace("A", ".")
            splited[-1] = splited[-1].replace("V", ".")

        if "R" in splited[0] or "R" in splited[-1]:
            splited[0] = splited[0].replace("V", ".")
            splited[-1] = splited[-1].replace("V", ".")

    if not farm.startswith("|"):
        splited[0] = runing(splited[0])

    if not farm.endswith("|"):
        splited[-1] = runing(splited[-1])

    return "|".join(splited)