Fixed print_lcs using global variable