The longest common subsequence problem for arc-annotated sequences