Added lcs.c, with auxilary functions and optimizations