This kata is the first of a sequence of four about "Squared Strings".

You are given a string of `n` lines, each substring being `n` characters long: For example:

`s = "abcd\nefgh\nijkl\nmnop"`

We will study some transformations of this square of strings.

- Vertical mirror:
vert_mirror (or vertMirror or vert-mirror)
```
vert_mirror(s) => "dcba\nhgfe\nlkji\nponm"
```
- Horizontal mirror:
hor_mirror (or horMirror or hor-mirror)
```
 hor_mirror(s) => "mnop\nijkl\nefgh\nabcd"
```

or printed:

```
vertical mirror   |horizontal mirror   
abcd --> dcba     |abcd --> mnop 
efgh     hgfe     |efgh     ijkl 
ijkl     lkji     |ijkl     efgh 
mnop     ponm     |mnop     abcd 
```

# Task:
- Write these two functions

and

- high-order function `oper(fct, s)` where

 - fct is the function of one variable f to apply to the string `s`
(fct will be one of `vertMirror, horMirror`)

# Examples:
```
s = "abcd\nefgh\nijkl\nmnop"
oper(vert_mirror, s) => "dcba\nhgfe\nlkji\nponm"
oper(hor_mirror, s) => "mnop\nijkl\nefgh\nabcd"
```
# Note:
The form of the parameter `fct` in oper
changes according to the language. You can see each form according to the language in "Sample Tests".

# Bash Note:
The input strings are separated by `,` instead of `\n`. The output strings should be separated by `\r` instead of `\n`. See "Sample Tests".

Forthcoming katas will study other transformations.

Difficulty: introductory

Starter code:

def vert_mirror(strng):
	

Solutions:
def vert_mirror(s):
    return "\n".join(line[::-1] for line in s.split("\n"))

def hor_mirror(s):
    return "\n".join(s.split("\n")[::-1])

def oper(fct, s):
    return fct(s)


def vert_mirror(strng):
    return map(reversed, strng)
def hor_mirror(strng):
    return reversed(strng)
def oper(fct, s):
    return '\n'.join(map(''.join, fct(s.split('\n'))))

def hor_mirror(s):
    return '\n'.join(reversed(s.split('\n')))


def vert_mirror(s):
    return '\n'.join(a[::-1] for a in s.split('\n'))


def oper(fct, s):
    return fct(s)

vert_mirror,hor_mirror,oper=lambda s:[e[::-1]for e in s],lambda s:s[::-1],lambda f,s:'\n'.join(f(s.split()))

def vert_mirror(strng):
    return "\n".join(w[::-1] for w in strng.split("\n"))

def hor_mirror(strng):
    return "\n".join(strng.split("\n")[::-1])

def oper(fct, strng):
    return fct(strng)


def vert_mirror(strng):
    lst_string = strng.split('\n')
    i = 0
    while i < len(lst_string):
        lst_string[i] = lst_string[i][::-1]
        i += 1
    return '\n'.join(lst_string)
    
def hor_mirror(strng):
    lst_string = strng.split('\n')
    i = 0
    l = len(lst_string)
    while i < l//2:
        fst_s = lst_string[i]
        lst_string[i] = lst_string[l-1-i]
        lst_string[l-1-i] = fst_s
        i += 1
    return '\n'.join(lst_string)
    
def oper(fct, s):
    return fct(s)


def vert_mirror(strng):
    return '\n'.join(s[::-1] for s in strng.split('\n'))
def hor_mirror(strng):
    return'\n'.join(strng.split('\n')[::-1])
def oper(fct, s):
    return fct(s)

hor_mirror = reversed
vert_mirror = lambda st: (i[::-1] for i in st)

def oper(fct, s):
    return '\n'.join(fct(s.split('\n')))

def vert_mirror(st):
    return (i[::-1] for i in st)

def hor_mirror(st):
    return st[::-1]

def oper(fct, s):
    return '\n'.join(fct(s.split('\n')))

def vert_mirror(strng):
    return [x[::-1] for x in strng.split("\n")]
def hor_mirror(strng):
    return strng.split("\n")[::-1]
def oper(fct, s):
    return '\n'.join(list(map(fct, [s]))[0])

def vert_mirror(strng):
    return (s[::-1] for s in strng.split('\n'))
    
def hor_mirror(strng):
    return strng.split('\n')[::-1]
        
def oper(fct, s):
    return '\n'.join(fct(s))

def format_to_list(string):
    return string.split('\n')

def stitch(array):
    return '\n'.join(array)

def vert_mirror(string):
    matrix = format_to_list(string)
    mirrored_matrix = []
    for row in matrix:
        mirrored_row = row[::-1] 
        mirrored_matrix.append(mirrored_row)
    return stitch(mirrored_matrix)

def hor_mirror(string):
    matrix = format_to_list(string)
    matrix.reverse()
    return stitch(matrix)
    
def oper(fct, s):
    return fct(s)

def vert_mirror(str_):
    return "\n".join(word[::-1] for word in str_.split("\n"))

def hor_mirror(str_):
    return "\n".join(str_.split("\n")[::-1])

def oper(fct, str_):
    return fct(str_)

def vert_mirror(strng):
    return '\n'.join(s[::-1] for s in strng.split('\n'))


def hor_mirror(strng):
    return '\n'.join(reversed(strng.split('\n')))


def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join([s[::-1] for s in strng.split('\n')])
def hor_mirror(strng):
    return '\n'.join(strng.split('\n')[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(lines):
    return '\n'.join(line[::-1] for line in lines.split('\n'))
def hor_mirror(lines):
    return '\n'.join(lines.split('\n')[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return "\n".join([x[::-1] for x in strng.split("\n")])
def hor_mirror(strng):
    return "\n".join(strng.split("\n")[::-1])
def oper(fct, s):
    return fct(s)


hor_mirror, vert_mirror, oper = reversed, lambda m: map(reversed, m), lambda f, s: "\n".join(map("".join, f(s.split("\n"))))

def vert_mirror(strng):
  
    s =  strng.split("\n")
    rs = ["".join(reversed(x)) for x in s]
    return "\n".join(rs)
def hor_mirror(strng):
    s =  strng.split("\n")
    rs = [x for x in reversed(s)]
    return "\n".join(rs)
    
def oper(fct, s):
    return fct(s)

def vert_mirror(l):
    return [x[::-1] for x in l]
def hor_mirror(l):
    return l[::-1]
def oper(fct, s):
    return '\n'.join(fct(s.split()))

def vert_mirror(strng):
    # your code
    x = [i[::-1] for i in strng.split('\n')]
    return '\n'.join(x)

def hor_mirror(strng):
    # your code
    a = strng[::-1]
    x = [i[::-1] for i in a.split('\n')]
    return '\n'.join(x)
    
def oper(fct, s):
    # your code
    if fct == hor_mirror:
        return hor_mirror(s)
    else:
        return vert_mirror(s)

def vert_mirror(strng):
    k=[i[::-1] for i in strng.split('\n')]
    return '\n'.join(k)
def hor_mirror(strng):
    l=strng.split('\n')[::-1]
    return '\n'.join(l)
def oper(fct, s):
    return fct(s)


def vert_mirror(strng):
    return "\n".join(word[::-1] for word in strng.split('\n'))


def hor_mirror(strng):
    return "\n".join(reversed(strng.split('\n')))


def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return "\n".join("".join(word[i] for i in range(len(word)-1, -1, -1)) for word in strng.split('\n'))

def hor_mirror(strng):
    return "\n".join(word for word in reversed(strng.split('\n')))

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join(i[::-1] for i in strng)

def hor_mirror(strng):
    return '\n'.join(i for i in strng[::-1])

def oper(fct, s):
    return fct(s.split('\n'))

def vert_mirror(strng):
    return '\n'.join(i[::-1] for i in strng.split('\n'))

def hor_mirror(strng):
    return '\n'.join(''.join(i) for i in [(c for c in word) for word in strng.split('\n')][::-1])

def oper(fct, s):
    return fct(s)

import unittest


def vert_mirror(strng):
    return '\n'.join(word[::-1] for word in strng.split('\n'))


def hor_mirror(strng):
    return '\n'.join(strng.split('\n')[::-1])


def oper(fct, s):
    return fct(s)


class TestVertAndHorMirror(unittest.TestCase):
    def test_vert_mirror(self):
        fct, s = vert_mirror, "hSgdHQ\nHnDMao\nClNNxX\niRvxxH\nbqTVvA\nwvSyRu"
        actual = oper(fct, s)
        self.assertEqual(actual, "QHdgSh\noaMDnH\nXxNNlC\nHxxvRi\nAvVTqb\nuRySvw")

    def test_hor_mirror(self):
        fct, s = hor_mirror, "lVHt\nJVhv\nCSbg\nyeCt"
        actual = oper(fct, s)
        self.assertEqual(actual, "yeCt\nCSbg\nJVhv\nlVHt")


def reverse_str(str):
    return str[::-1]


def vert_mirror(strng):
    string_list = strng.split("\n")
    result = ""
    for i, element in enumerate(string_list):
        result = result + reverse_str(element)
        if i != len(string_list) - 1:
            result += "\n"
    return result

def hor_mirror(strng):
    string_list = strng.split("\n")
    result = ""
    for i, element in enumerate(string_list):
        result = element + result
        if i != len(string_list) - 1:
            result = "\n" + result 
    return result
    
def oper(fct, s):
    return fct(s)


def vert_mirror(strng):
    strng = strng.split("\n")
    res = []
    for substr in strng:
        res.append(substr[::-1])
    res = '\n'.join(res)
    return res
def hor_mirror(strng):
    strng = strng.split("\n")
    res = []
    for index in range(len(strng)):
        res.append(strng[len(strng) - index - 1])
    res = '\n'.join(res)
    return res
def oper(fct, s):
    if (fct == vert_mirror):
        return vert_mirror(s)
    elif (fct == hor_mirror):
        return hor_mirror(s)


vert_mirror = lambda strng: '\n'.join(i[::-1] for i in strng.split())
hor_mirror = lambda strng: '\n'.join(strng.split()[::-1])
oper = lambda fct, s: fct(s)

def vert_mirror(strng):
    return '\n'.join(chunk[::-1] for chunk in strng.split('\n'))
    
def hor_mirror(strng):
    return '\n'.join(strng.split('\n')[::-1])
    
def oper(fct, s):
    return fct(s)

from string import ascii_letters

def vert_mirror(strng):
    return "\n".join(w[::-1] for w in strng.split('\n'))

def hor_mirror(strng):
    return "\n".join(w for w in strng.split('\n')[::-1])

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return (line[::-1] for line in strng.split('\n'))
def hor_mirror(strng):
    return strng.split('\n')[::-1]
    # your code
def oper(fct, s):
    return '\n'.join(fct(s))

def vert_mirror(strng):
    segments = strng.split('\n')
    for i in range(len(segments)):
        segments[i] = segments[i][::-1]
    return segments
    
    # your code
def hor_mirror(strng):
    segments = strng.split('\n')
    s = segments[::-1]
    return s
    # your code
def oper(fct, s):
    return '\n'.join(fct(s))
    # your code


def vert_mirror(s):
    return '\n'.join(list(map(lambda x: x[::-1],s.split('\n'))))
    
def hor_mirror(s):
    return '\n'.join(s.split('\n')[::-1])
    
def oper(f, s):
    if str(f).split()[1] == 'vert_mirror': return vert_mirror(s)
    return hor_mirror(s)

def vert_mirror(strng):
    return "\n".join([strng.split('\n')[i][::-1] for i in range(len(strng.split('\n')))])

def hor_mirror(strng):
    return "\n".join(strng.split('\n')[::-1])

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    v_mirror = []
    for row in strng.split("\n"):
        v_mirror.append(row[::-1])
    return "\n".join(v_mirror)

def hor_mirror(strng):
    return "\n".join(list(reversed(strng.split("\n"))))

def oper(fct, s):
    if fct == vert_mirror:
        return vert_mirror(s)
    else:
        return hor_mirror(s)

def vert_mirror(strng):
    s = strng.split('\n')
    return '\n'.join([x[::-1] for x in s])
def hor_mirror(strng):
    s = strng.split('\n')
    return '\n'.join(s[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    L=[]
    str = strng.split("\n")
    for s in str:
        L.append(s[::-1])
    return "\n".join(L)
def hor_mirror(strng):
    str = strng.split("\n")
    return "\n".join(str[::-1])
    
def oper(fct, s):
    return fct(s)


def vert_mirror(strng: str):
    return "\n".join(el[::-1] for el in strng.split())


def hor_mirror(strng: str):
    return "\n".join(reversed(strng.split()))


def oper(fct, s):
    return fct(s)


vert_mirror = lambda S   : '\n'.join(s[::-1] for s in S.split('\n'))
hor_mirror  = lambda S   : '\n'.join(S.split('\n')[::-1])
oper        = lambda f, S: f(S)

def vert_mirror(strng):
    strng = strng.split('\n')
    strng = [i[::-1] for i in strng]
    return '\n'.join(strng)

def hor_mirror(strng):
    strng = strng.split('\n')
    strng = strng[::-1]
    return '\n'.join(strng)

def oper(fct, s):
    return fct(s)

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    vert = strng.split()
    vert1 = []
    vert2 = '\n'
    for i in range(len(vert)):
        vert1.append(vert[i][::-1])
    return (vert2.join(vert1))
    
def hor_mirror(strng):
    hor = strng.split()
    hor1 = hor[::-1]
    hor2 = '\n'
    return hor2.join(hor1)



def vert_mirror(st):
    a = st.split("\n")
    for i in range(len(a)):
        a[i] = list(a[i])
        a[i].reverse()
        a[i] = ''.join(a[i])
    return  "\n".join(a)
def hor_mirror(st):
    a = st.split('\n')
    a.reverse()
    return "\n".join(a)
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    lst = strng.split()[::-1]
    return "\n".join(lst)[::-1]


def hor_mirror(strng):
    lst = strng.split()[::-1]
    return "\n".join(lst)


def oper(fct, s):
    return fct(s)

from typing import Callable

def oper(callback: Callable[[str], str], string: str) -> str:
    return callback(string)

def vert_mirror(string: str) -> str:
    return '\n'.join([
        line[::-1] for line in string.split('\n')
    ])

def hor_mirror(string: str) -> str:
    return '\n'.join(
        string.split('\n')[::-1]
    )

def vert_mirror(strng):
    strs=strng.split('\n')
    for s in range(len(strs)):
        strs[s] = strs[s][::-1]
    return '\n'.join(strs)
    
def hor_mirror(strng):
    stsrs=strng.split('\n')
    return '\n'.join(stsrs[::-1])
    
def oper(fct, s):
    return fct(s)
    
    
    


def vert_mirror(strng):
    return '\n'.join(w[::-1] for w in strng.split())

def hor_mirror(strng):
    return '\n'.join(strng.split()[::-1])
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    ans = ""
    sq = strng.split("\n")
    dim = len(sq)
    for i in range (0,dim,1):
        print(i)
        ans += str(sq[i][::-1]) + "\n"    
    return ans.rstrip("\n")
    
def hor_mirror(strng):
    ans = ""
    sq = strng.split("\n")
    dim = len(sq)
    for i in range (dim,0,-1):
        ans += str(sq[i-1]) + "\n"  
    return ans.rstrip("\n")

def oper(fct, s):
    return vert_mirror(s) if fct == vert_mirror else hor_mirror(s)

def vert_mirror(string):
    mylist = string.split('\n')  #splits into list of the parts
    for x in range(len(mylist)):
        mylist[x] = mylist[x][::-1]  
    mystring = '\n'.join(mylist)
    return mystring
def hor_mirror(string):
    mylist = string.split('\n')
    mylist = mylist[::-1]
    mystring = '\n'.join(mylist)
    return mystring
def oper(fct, s):
    if fct == vert_mirror:
        return vert_mirror(s)
    elif fct==hor_mirror:
        return hor_mirror(s)


def vert_mirror(strng):
    return [x[::-1] for x in strng]
def hor_mirror(strng):
    return strng[::-1]
def oper(fct, s):
    strng=s.split("\n")
    return "\n".join(fct(strng))

def vert_mirror(strng):
    return "\n".join(["".join(list(word)[::-1]) for word in strng.split()])

def hor_mirror(strng):
    return "\n".join(strng.split()[::-1])

def oper(fct, s):
    return eval('fct(s)')

def vert_mirror(strng):
    return "\n".join(cs[::-1] for cs in strng.split("\n"))
    
def hor_mirror(strng):
    return "\n".join(strng.split("\n")[::-1])
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return "\n".join(cs[::-1] for cs in strng.split("\n"))
    
def hor_mirror(strng):
    return "\n".join(strng.split("\n")[::-1])
    
def oper(fct, s):
    return vert_mirror(s) if fct == vert_mirror else hor_mirror(s)

def vert_mirror(strng):
    strng = strng.split('\n')
    return '\n'.join(i[::-1] for i in strng)

def hor_mirror(strng):
    strng = strng.split('\n')
    return '\n'.join(i for i in reversed(strng))

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    l = strng.split('\n')
    p = []
    for i in l:
        p.append(i[::-1])
    return '\n'.join(p)
def hor_mirror(strng):
    l = list(reversed(strng.split('\n')))
    return '\n'.join(l)
def oper(fct, s):
    return fct(s)

def vert_mirror(str):
    return '\n'.join([i[::-1] for i in str.split('\n')])
    
def hor_mirror(str):
    return '\n'.join(str.split('\n')[::-1])
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    lines = strng.split("\n")
    transformed_lines = ["".join(reversed(line)) for line in lines]
    return "\n".join(transformed_lines)
    
def hor_mirror(strng):
    lines = strng.split("\n")
    return "\n".join(reversed(lines))
    
def oper(fct, s):
    return fct(s)

def vert_mirror(s):
    return '\n'.join(m[::-1] for m in s.split('\n'))
def hor_mirror(s):
    return '\n'.join(s.split('\n')[::-1])
def oper(fct, s):
    return fct(s)


def vert_mirror(s):
    return '\n'.join([s.split('\n')[0][::-1]] + [m[1:][::-1]+m[0] for m in s.split('\n')[1:]])
def hor_mirror(s):
    return '\n'.join(s.split('\n')[::-1])
def oper(fct, s):
    return fct(s)


def vert_mirror(strng):
    strng = strng.split("\n")
    output = []
    for word in strng:
        output.append(word[::-1])
    return '\n'.join(output)    
def hor_mirror(strng):
    strng = strng.split("\n")
    output = []    
    return '\n'.join(strng[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(string):
    return [s[::-1] for s in string]
def hor_mirror(string):
    return string[::-1]
def oper(fct, s):
    return '\n'.join(fct(s.split('\n')))

def vert_mirror(strng):
    sub_list = strng.split("\n")
    for index, substr in enumerate(sub_list):
        sub_list[index] = substr[::-1]
    return "\n".join(sub_list)

def hor_mirror(strng):
    sub_list = strng.split("\n")
    sub_list.reverse()
    return "\n".join(sub_list)

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join([text[::-1] for text in strng.split('\n')])
    
def hor_mirror(strng):
    return '\n'.join(strng.split('\n')[::-1])
    
def oper(fct, s):
    return vert_mirror(s) if fct is vert_mirror else hor_mirror(s)


def vert_mirror(value: str):
    return '\n'.join([s[::-1] for s in value.split('\n')])

def hor_mirror(value):
    return '\n'.join(value.split('\n')[::-1])

def oper(func, value):
    return func(value)


def vert_mirror(strng):
    lst = strng.split("\n")
    return "\n".join("".join(i[::-1]) for i in lst)
def hor_mirror(strng):
    lst = strng.split("\n")
    return "\n".join(lst[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(s):
    lst = s.split('\n')
    return '\n'.join([x[::-1] for x in lst])
    
def hor_mirror(s):
    lst = s.split('\n')
    return '\n'.join(lst[::-1])
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    s = strng.split("\n")
    l = list()
    for i in s:
        l.append(i[::-1])
    return "\n".join(str(i) for i in l)
def hor_mirror(strng):
    s = strng.split("\n")
    return "\n".join(str(i) for i in s[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return "\n".join([x[::-1] for x in strng.split("\n")])
def hor_mirror(strng):
    return "\n".join(x for x in strng.split("\n")[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    strng = strng.split("\n")
    return "\n".join(s[::-1] for s in strng)
    
def hor_mirror(strng):
    strng = strng.split("\n")
    return "\n".join(strng[::-1])
    
def oper(fct, s):
    return fct(s)

from typing import Callable


def vert_mirror(strng: str) -> str:
    return '\n'.join(s[::-1] for s in strng.splitlines())


def hor_mirror(strng: str) -> str:
    return '\n'.join(strng.splitlines()[::-1])


def oper(fct: Callable[[str], str], s) -> str:
    return fct(s)


import re
def vert_mirror(strng):
    x=re.split("\s",strng)
    y=[i[::-1] for i in x]
    return '\n'.join(y)
def hor_mirror(strng):
    x=re.split('\s',strng)
    a=x[::-1]
    return '\n'.join(a)
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join([a[::-1] for a in strng.split('\n')])
def hor_mirror(strng):
    return '\n'.join(reversed(strng.split('\n')))
def oper(fct, s):
    return fct(s)

vert_mirror = lambda s: '\n'.join(r[::-1] for r in s.split('\n'))
hor_mirror = lambda s: '\n'.join(s.split('\n')[::-1])
oper = lambda f, s: f(s)

def vert_mirror(strng):
    return '\n'.join(''.join(reversed(line)) for line in strng.split('\n'))

def hor_mirror(strng):
    return '\n'.join(reversed(strng.split('\n')))

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    # your code
    p=[]
    s=strng.split("\n")
    for i in s:
        p.append(i[::-1])
    return "\n".join(p)
def hor_mirror(strng):
    # your code
    s=strng.split("\n")
    p=s[::-1]
    return "\n".join(p)
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join(list(map(lambda x: x[::-1], strng.split('\n'))))

def hor_mirror(strng):
    return '\n'.join(list(map(lambda x: x[::-1], strng[::-1].split('\n'))))

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    arr = [s[::-1] for s in strng.split('\n')]
    return('\n'.join(arr))
def hor_mirror(strng):
    print('there')
    return('\n'.join([s for s in strng.split('\n')][::-1]))
def oper(fct, s):
    return(fct(s))

def vert_mirror(strng):
    # your code
    lst = strng.split('\n')
    return '\n'.join(i[::-1] for i in lst)
def hor_mirror(strng):
    lst = strng.split('\n')
    return '\n'.join(lst[::-1])
def oper(fct, s):
    return vert_mirror(s) if fct == vert_mirror else hor_mirror(s)

def vert_mirror(strng):
    return '\n'.join(elem[::-1] for elem in strng.split('\n'))
def hor_mirror(strng):
    return '\n'.join(strng.split('\n')[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(s):
    return "\n".join(["".join([line[i] for i in range(len(line)-1,-1,-1)]) for line in s.splitlines()])
def hor_mirror(s):
    return "\n".join([s.splitlines()[i] for i in range(len(s.splitlines())-1,-1,-1)])
def oper(fct, s):
    return fct(s)

def vert_mirror(parts):
    return [p[::-1] for p in parts]

def hor_mirror(parts):
    return parts[::-1]

def oper(fct, s):
    parts = s.split('\n')
    return '\n'.join(fct(parts))

def vert_mirror(strng):
    return "\n".join([e[::-1] for e in strng.split()])

def hor_mirror(strng):
    return "\n".join([e for e in strng.split()[::-1]])

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return "".join([e[::-1]+"\n" for e in strng.split()])[0:-1]

def hor_mirror(strng):
    return "".join([e+"\n" for e in strng.split()[::-1]])[0:-1]

def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join([
        row[::-1] for row in strng.split('\n')
    ])
def hor_mirror(strng):
    return '\n'.join([
        row for row in reversed(strng.split('\n'))
    ])
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):  
    return '\n'.join([x[::-1] for x in strng.split('\n')])
def hor_mirror(strng):
    return '\n'.join([x for x in strng.split('\n')[::-1]])
def oper(fct, s):
    if fct == vert_mirror:
        return vert_mirror(s)
    elif fct == hor_mirror:
        return hor_mirror(s)

def vert_mirror(strng):
    return '\n'.join([s[::-1] for s in strng.split('\n')])
def hor_mirror(strng):
    return '\n'.join([s for s in strng.split('\n')[::-1]])
def oper(fct, s):
    return fct(s)

vert_mirror = lambda x:'\n'.join([i[::-1] for i in x.split('\n')])
hor_mirror = lambda x: '\n'.join(x.split('\n')[::-1])
oper = lambda x, y: x(y)

def vert_mirror(strng):
    subStrings = strng.split('\n')
    reversedStrings = [substring[::-1] for substring in subStrings]
    joinedStrings = '\n'.join(reversedStrings)
    return joinedStrings
    
def hor_mirror(strng):
    subStrings = strng.split('\n')
    reversedStrings = [substring for substring in reversed(subStrings)]
    joinedStrings = '\n'.join(reversedStrings)
    return joinedStrings
    
def oper(fct, s):
    return fct(s)

def vert_mirror(string):
    return '\n'.join(s[::-1] for s in string.split('\n'))
    
    
def hor_mirror(string):
    return '\n'.join(string.split('\n')[::-1])
    
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    a = strng.split("\n")
    vert_m = ''

    for word in a:
        vert_m +=word[::-1] +"\n"

    return vert_m.strip("\n")


def hor_mirror(strng):
    a = strng.split("\n")
    a.reverse()
    hor_m = ''

    for word in a:
        hor_m += word + "\n"

    return hor_m.strip("\n")


def oper(fct, s):
    return fct(s)

def vert_mirror(s):
    return "\n".join([w[::-1] for w in s.split("\n")])
def hor_mirror(s):
    return "\n".join([w for w in s.split("\n")][::-1])
def oper(fct, s):
    return fct(s)

n="\n"
def vert_mirror(s):
    return n.join([elem[::-1] for elem in s.split(n)])
def hor_mirror(s):
    return n.join(s.split(n)[::-1])
def oper(fct, s):
    return fct(s)

def vert_mirror(s):
    splitted_s = s.split('\n')
    l = []
    for word in splitted_s:
        reversed_word = word[::-1]
        l.append(reversed_word)
    new_s = '\n'.join(l)
    return(new_s)


def hor_mirror(s):
    splitted_s = s.split('\n')
    splitted_s.reverse()
    return('\n'.join(splitted_s))

def oper(fct, s):
    return(fct(s))

def vert_mirror(s):
    return '\n'.join(_[::-1] for _ in s.split())
def hor_mirror(s):
    return  '\n'.join(s.split()[::-1])
def oper(fct, s):
   return fct(s)
# Flez
   


def vert_mirror(s):
    s = s.splitlines()
    for i in range(len(s)):
        s[i] = s[i][::-1]
    s = '\n'.join(s)
    return s

def hor_mirror(s):
    s = s[::-1].splitlines()
    for i in range(len(s)):
        s[i] = s[i][::-1]
    s = '\n'.join(s)
    return s

def oper(fct, s):
    return fct(s)

def vert_mirror(string):
    return "\n".join(row[::-1] for row in string.split("\n"))
    
def hor_mirror(string):
    return "\n".join(string.split("\n")[::-1])
    
def oper(fct, string):
    return fct(string)

def vert_mirror(strng):
    a = strng.split("\n")
    b = [i[::-1] for i in a]
    return "\n".join(b)
def hor_mirror(strng):
    a = strng.split("\n")
    b = a[::-1]
    return "\n".join(b)
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    strng_list = strng.split('\n')
    for i in range(len(strng_list)):
        strng_list[i] = strng_list[i][::-1]
    return "\n".join(strng_list)    
    
def hor_mirror(strng):
    strng_list = strng.split('\n')
    strng_list.reverse()
    return "\n".join(strng_list)
    
def oper(fct, s):
    return fct(s)

def vert_mirror(strng):
    return '\n'.join([r[::-1] for r in strng.split('\n')])
def hor_mirror(strng):
    return '\n'.join([r for r in strng.split('\n')][::-1])
def oper(fct, s):
    return fct(s)