| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Incremental Python Parsing
Description For the sake of simplicity, only the following subset of Python syntax is considered: From the syntax some terms are defined as follows: String: a sequence delimited by quotes ( Examples: (Python actually Bracket-enclosed text: a sequence of characters other than brackets or quotes enclosed by matched pairs of brackets. Example: Logical new-line: a new-line character that is not part of a string or bracket-enclosed text Physical line: a maximal sequence of characters other than new-line characters Examples: Logical line: a maximal sequence of characters other than logical new-lines Examples: Valid/invalid program: a program without/with mismatched quotes or brackets that are not part of any strings Examples: Given a program, you are to implement the following primitive operations: Input The given program appears first in the input followed by a line with a single The program contains up to 106 characters (including new-lines) and 105 physical lines each consisting of up to 80 characters. And there will be at most 105 operations. Output For each query operation, output a line containing the logical line number. Sample Input Sample Output Source |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2006 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator