<reponame>fmelihh/competitive-programming-solutions<filename>codewars-python/Moves-in-squared-strings(IV).py

# https://www.codewars.com/kata/56dbf59b0a10feb08c000227/train/python

def diag_2_sym(strng):
    input_string = strng.split('\n')
    output_string = [''] * len(input_string)

    length = len(input_string) - 1
    for elements in input_string:
        for char_index, element in enumerate(elements):
            output_string[length - char_index] = element + output_string[length - char_index]
            
    return '\n'.join(output_string)

def rot_90_counter(strng):
    
    input_string = diag_2_sym(strng).split('\n')

    for index, element in enumerate(input_string):
        input_string[index] = element[::-1]

    return '\n'.join(input_string)

def selfie_diag2_counterclock(strng):

    reversed_symetric_string = diag_2_sym(strng).split('\n')
    symetric_string = rot_90_counter(strng).split('\n')
    input_string = strng.split('\n')

    output_string = []

    for non_symetric, revesed_symetric, symetric in zip(input_string, reversed_symetric_string, symetric_string):
        output_string.append(f'{non_symetric}|{revesed_symetric}|{symetric}')

    return '\n'.join(output_string)

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