Dear colleagues,
thank you very much for you interest in my problem. Special
thanks to "Ivan Golubev" for his interest in my person.
The problem with graphical editor is very old and widely spread.
I believe you can find this problem or some of it parts in every
programming manual. Since I signed the variant for Online Judge,
let me answer the questions (I insist that all the answer are in the problem description):
1. Can it be any commands after a X command?
I think it does not matter since X terminates the session.
2. Can a S happen with no NAME? (just S on a line)
3. If the color is not a upper case letter, should I use it?
By default all the input data for the problems are correct. The "errors"
section of the problem description claims that the only
error in input data you should care about is wrong first letter in a line.
"In case of other errors the program behaviour is
unpredictable" simply means that there will not be any other
error.
4. I skip the line with fgets(cmd,10000, stdin); Can a line be > then 10000 chars?
I used readln

I do not remember the tests I submitted, but I do
not think there are so long lines. It is not the matter of the
problem.
5. Can the filename on S command be > 20 chars? (DOS 8.3 uses one 12 + '\0' chars)
I do not think that 12 can be >20.
6. Is diagonal neighbours of a pixel?
No, since there should be a "common side".
7. Can u think in any other problem in this problem?
Well, there is nothing special in this problem. Just verify, what
is the number of rows, what is the number of columns, check how
do you fill the segment
between X1 and X2. I was told that in C
the arrays (I guess you use array) are numbered from 0, in the
problem --- from 1. As to region filling algorithm, I used so
called "stack of postponed jobs". But I have heard that the recursive
one is also OK.