Hi, A1. Thx for your support and sorry for the long delay. It's strange that this code i've posted compiles ok in my box... Anyway i got it AC after a closer look. (the mistake was around the "leading_blanks problem" - my input routine was just "eating" the blanks!
(I'll be removing my code from the last post.)
This algorithm just omits nonalphabetical characters.
That means that "hello5how6are8you" becomes "hellohowareyou".
So there is only one big word instead of 3 words which could be in the dictionary.
A keyword ``occurs" in an excuse if and only if it exists in the string in contiguous form and is delimited by the beginning or end of the line or any non-alphabetic character or a space.
(Well, this topic is rather old, but for those of you who might have similar problem.)
It shoud be: All excuses can contain any upper or lower case alphanumeric character, a space, or any of the following punctuation marks [@#".,!?&] not including the square brackets and will not exceed 70 characters in length.
Greetings!
Besides the good observations already made, I found out that if you don't print the worst excuses (if > 1) in the order they appear in the input, you'll get a W.A.
The next statement is corrupted:
If there is more than one worst excuse, you may print them in any order.
"... Then people will see the Son of the
Man (God) coming in a cloud, with power and great glory."(Lucas 21:25 to 29) - Try to receive Jesus while you can find Him.
Most likely it's a buffer overflow. Text doesn't say that each word in excuses will be at most 20 characters (it could be up all 70 characters), but your program assumes that.
Why do you use so small arrays? Personally I'd just use the first round number, say 100, for all array sizes here, and it would work fine.
Also, scanf format is a bit wrong here: scanf("%d %d%", &m, &n). And if you want scanf() to read all characters up to the end of the line, and including \n character, just use: scanf("%d %d%*[^\n]%*c", &m, &n).
Thank guru i got acc..
I think this line in the problem statement is wrong..
All excuses can contain any upper or lower case alphanumeric character, a space, or any of the following punctuation marks [SPMamp".,!?&] not including the square brackets and will not exceed 70 characters in length.
That's why i got RTE..
And i used scanf directly because..
I got this line for gets:-
I had trouble getting it accepted. I did a funny thing. In stead of putting a newline character in between the outputs, I put it at the end of every output. And then it was accepted. It was funny because it could have shown presentation error instead of WA.