@anonymous/

DizzyAzureFowl

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def LCS(X, Y):
    if len(X) == 0 or len(Y) == 0:
        return []
    if X[-1] == Y[-1]:
        return LCS(X[:-1], Y[:-1]) + [X[-1]]
    else:
        return longest(LCS(X, Y[:-1]), LCS(X[:-1], Y))


def longest(X, Y):
	return X if len(X) > len(Y) else Y


print("".join(LCS("schwarzenegger", "chuarcheneger")))