ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1345. HTML

Grammar clarifications
Posted by Denis Koshman 17 Aug 2008 01:01
Got AC 0.001 sec from the first effort :) I saw many requests for clarification here, but it's easier to describe grammar in terms of behavior.

Go sequentially through input data.

1. If you meet '{' - everything until closest corresponding '}' is a single comment, no matter what's inside. '}' corresponds to '{' if all {,} characters between them form valid bracket sequence.

2. If you meet '//' - everything until '\n' is a single comment, no matter what's inside.

3. If you meet ' - everything until next ' is a string, no matter what's inside.

3. If you meet '#' followed by a digit - everything until first non-digit is a string.

4. If you meet a digit, then everything until first non-digit is a number. If first non-digit character is '.' AND it is followed by another digit, then this post-dot digit sequence is appended to the number as well as the dot itself. I.e. "1.23" is a single number, but "123.a" is number '123' followed by '.', followed by identifier 'a'.

5. If you meet underscore or letter, everything until first non-digit-non-underscore-non-letter is an identifier. It may be a keyword.

6. Output all other characters as is.

Edited by author 17.08.2008 01:02
Re: Grammar clarifications
Posted by svr 10 Jan 2009 20:04
These statements should be stated in problem
description. They are all right and to recreate them
I tried 50 submissions.
In western sytes it is a rule punctual and clear
descriptions all conditions but in our country
often used believeness in super talantedness of us.

Edited by author 10.01.2009 20:26
Re: Grammar clarifications
Posted by Oracle[Lviv NU] 11 Nov 2009 16:20
Really helpful! Link to this post should be added to the statement :-)