Thought it is a simple text processing problem.
But get WA all the time.
Would someone give some input/output? Thx

Moderator: Board moderators
According the problem, Each contraction may appear as listed, entirely uppercase, or capitalized (first letter uppercase, remaining letters as listed). The expansion should follow the same rule; if a contraction is uppercased, the expansion should be uppercased as well.Andrey Mokhov wrote: 1. Suppose, you have a contraction "AB" -> "A and B" and you meet in text string AB. According to the problem statement you should output "A and B" - not "A AND B". Note, that if the contraction were "Ab" -> "A and B" than you would print "A AND B", however.
If more than one case applies, choose the earliest matching case in the list: "as listed," "uppercased," and "capitalized."2. If you have two contractions "AB C"->"A B and C" and "AB"->"A and B" and analize string AB C D ... you shouldn't stop when you found match AB - you are to continue comparing because you will meet AB C which should be replaced as its contraction appear earlier in the input.
Andrey.
The problem is that sometimes you can't say if it is as listed, uppercased or capitalized! Can you say AB is uppercased or as listed if it was AB at start? So as problem statement says in such case you should consider it to be written as listed:windows2k wrote:Each contraction may appear as listed, entirely uppercase, or capitalized (first letter uppercase, remaining letters as listed). The expansion should follow the same rule; if a contraction is uppercased, the expansion should be uppercased as well.
And nowIf more than one case applies, choose the earliest matching case in the list: "as listed," "uppercased," and "capitalized."
No, all three cases are incorrect!windows2k wrote:If I have a contraction "AB" -> " A and B"
when I input ab , I should output "a and b"?
AB, I should output "A AND B"?
Ab,, I should output "A and b"?
Code: Select all
2 1
"it's" -> "it is"
".." -> "."
"EL" -> "European License"
HELLO! It's obvious that Babbit's EL is expired......
#
Code: Select all
HEuropean License (EL)LO! It is obvious that Babbit is EL is expired...
#