10252 - Common Permutation
Moderator: Board moderators
You have wrong understanding on the question.
For the input:
ab
ba
the output is:
ab
Actually this question can be solved easily once you udnerstand what it asks you to do.
For the input:
ab
ba
the output is:
ab
Actually this question can be solved easily once you udnerstand what it asks you to do.
My signature:
- Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code. - I HATE testing account.
- Don't send me source code for debug.
thank u, and sorry to disturb u.
i actually can't understand the problem.
it seems to me as a lcs prob.
i rarely put src. code in board. but sometimes when i can't get rid of a lot of wa, i become frustated and then put it.
please tell me abuot the problem and algrthm in a simpler way, please?

i actually can't understand the problem.
it seems to me as a lcs prob.
i rarely put src. code in board. but sometimes when i can't get rid of a lot of wa, i become frustated and then put it.
please tell me abuot the problem and algrthm in a simpler way, please?


"Everything should be made simple, but not always simpler"
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.
You miss the word permutation in the problem spec. That's why for the input
ab
ba
the output is
ab
because "ba" is a permutation of "ab" at all.
You miss the word permutation in the problem spec. That's why for the input
ab
ba
the output is
ab
because "ba" is a permutation of "ab" at all.
My signature:
- Please make discussion about the algorithm BRFORE posting source code.
We can learn much more in discussion than reading source code. - I HATE testing account.
- Don't send me source code for debug.
-
- Experienced poster
- Posts: 151
- Joined: Wed Aug 21, 2002 12:07 am
- Location: Seoul, Korea
- Contact:
I experienced the same problem..
from the problem statement we find:
The input strings include blank characters. Try using gets() instead of scanf().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.
10252-- input problem
I tried to use cin.getline for input. Surprisingly, it stops after the blank lines. Why is it ?
Should I just use cin and !cnt.good to terminate the program ?
What makes difference ?
Should I just use cin and !cnt.good to terminate the program ?
What makes difference ?
10252 - Common Permutation
input: down
won
output: won or now ?
I am guessing it would be "now" since in the sample second test case ..
input: walking down
output: nw (and not wn)
I am just curious, for some reason I keep getting WA on this problem.
won
output: won or now ?
I am guessing it would be "now" since in the sample second test case ..
input: walking down
output: nw (and not wn)
I am just curious, for some reason I keep getting WA on this problem.
Give a man an answer, and he's satisfied today. Teach him to program, and he will be frustrated for the rest of his life. [Anonymous]
-
- Learning poster
- Posts: 94
- Joined: Wed Jul 31, 2002 12:44 pm
- Location: Dacca, Bangladesh
- Contact:
output for:is ...
Greetings
Code: Select all
down
won
Code: Select all
now
Istiaque Ahmed [the LA-Z-BOy]