one of the main reason of not getting accepted is the input of blank lines...

Input file contains several lines of input. Consecutive two lines make a set of input. That means in the input file line 1 and 2 is a set of input, line 3 and 4 is a set of input and so on.

I think this problem has some mistakes in statement.

In the problem:
It says:

Each string is on a separate line and consists of at most 1000 lowercase letters

But when I used scanf("%s") to read input and just considered the lowercase letters,I got wrong answer.
Then I changed to all ASCII characters and used gets() ,eventually I got accepted.

Given two strings of lowercase letters, a and b, print the longest string x of lowercase letters such that there is a permutation of x that is a subsequence of a and there is a permutation of x that is a subsequence of b.

Yeah, I got the same problem like you. But after I change scanf("%s"); with gets();, I got AC. Apparently each string doesn't only contain lowercase letter. The problem didn't mention this!!!

There are 3 things one need to be successful : motivation, ability and chance. And if you're a believer, make it four : God's will.

Although there is a much simpler solution to this problem I also started solving it with Longest Common Subsequence algorithm. On my computer it works perfectly OK producing the write answer of tons of input. But the OJ says WA.

The simpler solution is accepted only if you process the input reading lines. It seems that the judge's input data is incorrect.

DID ANYBODY OF YOU GET ACCEPTED USING THE LCS ALGORITHM?