Given three sequences A[1:m], B[1:n] and C[1:h], the longest common subsequence problem is finding a sequence U such that U is a common subsequence of A[1:m], B[1:n], C[1:h] and the length of U is maximum. Without loss of generality, we assume h≧n≧m. In this paper, we present an algorithm to solve the longest common subsequence for three sequences in O(mnl) time where l is the length of U.