230 - Borrowers
来源:互联网 发布:微信小程序 源码下载 编辑:程序博客网 时间:2024/05/01 19:04
I mean your borrowers of books -those mutilators of collections, spoilers of the symmetry of shelves, andcreators of odd volumes.
- (Charles Lamb, Essays of Elia (1823)`The Two Races of Men')
Like Mr. Lamb, librarians have theirproblems with borrowers too. People don't put books back where they should.Instead, returned books are kept at the main desk until a librarian is free toreplace them in the right places on the shelves. Even for librarians, puttingthe right book in the right place can be very time-consuming. But since manylibraries are now computerized, you can write a program to help.
When a borrower takes out or returns abook, the computer keeps a record of the title. Periodically, the librarianswill ask your program for a list of books that have been returned so the bookscan be returned to their correct places on the shelves. Before they arereturned to the shelves, the returned books are sorted by author and then titleusing the ASCII collating sequence. Your program should output the list ofreturned books in the same order as they should appear on the shelves. For eachbook, your program should tell the librarian which book (including thosepreviously shelved) is already on the shelf before which the returned bookshould go.
Input
First, the stock of the library will belisted, one book per line, in no particular order. Initially, they are all onthe shelves. No two books have the same title. The format of each line will be:
``title" by author
The end of the stock listing will be markedby a line containing only the word:
END
Following the stock list will be a seriesof records of books borrowed and returned, and requests from librarians forassistance in restocking the shelves. Each record will appear on a single line,in one of the following formats:
BORROW ``title"
RETURN ``title"
SHELVE
The list will be terminated by a linecontaining only the word:
END
Output
Each time the SHELVE commandappears, your program should output a series of instructions for the librarian,one per line, in the format:
Put `` " after `` "
or, for the special case of the book beingthe first in the collection:
Put ``title" first
After the set of instructions foreach SHELVE, output a line containing only the word:
END
Assumptions & Limitations:
1. A title is at most 80 characterslong.
2. An author is at most 80 characterslong.
3. A title will not contain the doublequote (") character.
SampleInput
"The Canterbury Tales" byChaucer, G.
"Algorithms" by Sedgewick, R.
"The C Programming Language" by Kernighan,B. and Ritchie, D.
END
BORROW "Algorithms"
BORROW "The C ProgrammingLanguage"
RETURN "Algorithms"
RETURN "The C ProgrammingLanguage"
SHELVE
END
SampleOutput
Put "The C Programming Language"after "The Canterbury Tales"
Put "Algorithms" after "TheC Programming Language"
END
- 230 - Borrowers
- 230 - Borrowers
- 230 - Borrowers
- UVA - 230 Borrowers
- UVa 230 - Borrowers
- UVA - 230 Borrowers
- UVA-230 Borrowers
- Uva - 230 - Borrowers
- UVA 230 Borrowers
- UVA 230(p136)----Borrowers
- UVa 230 Borrowers
- uva 230 Borrowers
- UVA 230 Borrowers
- uva 230 Borrowers
- UVa 230 Borrowers
- UVa 230 - Borrowers(模拟)
- UVA - 230 Borrowers string+vector
- UVA 230 Borrowers (STL运用)
- 10815 - Andy's First Dictionary
- 12096 - The SetStack Computer
- 212 - Use of Hospital Facilities
- HDU 1575 Tr A (矩阵快速幂)
- UVa 11375 Matches
- 230 - Borrowers
- 511 - Do You Know the Way to San Jose
- 822 - Queue and A
- PHP中错误控制@运算符
- 1593 - Alignment of Code
- 编程笔记_J2SE_LinkList&ArrayList&HashMap
- 1594 - Ducci Sequence
- 1595 - Symmetry
- 1596 - Bug Hunt