The citizens of Codeland read each word from right to left, meaning that lexicographical comparison works differently in their language. Namely, string ```a``` is lexicographically smaller than string ```b``` if either: ```a``` is a suffix of ```b``` (in common sense, i.e. ```b``` ends with a substring equal to ```a```); or their last ```k``` characters are the same but the ```(k + 1)th``` character from the right in string ```a``` is smaller than the same character in string ```b```.

Given an array of words in Codeland language, sort them lexicographically according to Codeland's unique rules.

For ```words = ["nigeb", "ta", "eht", "gninnigeb"]```, the output should be
```unusualLexOrder(words) = ["ta", "nigeb", "gninnigeb", "eht"]```.

In particular, ```"ta" < "nigeb"``` because ```'a' < 'b'``` and ```"nigeb" < "gninnigeb"``` because the former word is a suffix of the latter.

S: codefights.com

Difficulty: introductory

Starter code:

def unusual_lex_order(arr):
	

Solutions:
def unusual_lex_order(a):
    return sorted(a, key=lambda k: k[::-1])

def unusual_lex_order(arr):
    return sorted(arr, key=lambda s: s[::-1])

def unusual_lex_order(arr):
    return sorted(arr, key = lambda x: x[::-1])

def unusual_lex_order(arr):
    return sorted(arr, key = lambda word: word[::-1])

def unusual_lex_order(lst):
    return sorted(lst, key=lambda x: x[::-1])

def unusual_lex_order(strings):
    return sorted(strings, key=lambda s: s[::-1])

def unusual_lex_order(arr):
    return sorted(arr,key = lambda item : (item[-1])) if all(len(x) == 1 for x in arr) else sorted(arr,key = lambda item : (item[-1],item[-2])) if any(len(x) == 2 for x in arr) else sorted(arr,key = lambda item : (item[-1],item[-2],item[-3]))

def unusual_lex_order(arr):
    arr2 = []
    for elem in arr:
        arr2.append(elem[::-1])
    arr2 = sorted(arr2)
    arr3 = []
    for elem in arr2:
        arr3.append(elem[::-1])
    return arr3

def unusual_lex_order(arr):
    return sorted(arr, key=lambda x: (x[::-1], len(x)))

def unusual_lex_order(arr):
    ans = [s[::-1] for s in arr]
    ans.sort()
    return [s[::-1] for s in ans]