Calculates candidates for lcs.