Submit | All submissions | Best solutions | Back to list |
LIB - Literature List |
In separate lines of a file you are given the titles of publications, written in lower-case letters. With nothing at your disposal but the Brainf**k language, write a converter from this style of naming to a format in which the first letter of each word is upper-case and a title ends with a dot.
The Brainf**k language consists of eight commands, listed below. A Brainf**k program is a sequence of these commands, possibly interspersed with other characters (which are ignored). The commands are executed sequentially, except as noted below.
The Brainf**k language uses a simple machine model which (apart from the executed code) consists of an array of 32,768 int32 cells initialized to zero, a movable pointer to an array cell (initialized to point to the leftmost cell of the array), and two streams of ints for input and output (most often connected to a keyboard and a monitor respectively, and using the ASCII character encoding).
The eight language commands, each consisting of a single character, are the following :
'>' : increment the pointer (to point to the next cell to the right).
'<' : decrement the pointer (to point to the next cell to the left).
'+' : increment (increase by one) the byte at the pointer.
'-' : decrement (decrease by one) the byte at the pointer.
',' : accept one byte of input (stdin), storing its value in the byte at the pointer.
'.' : output (to stdout) the value of the byte at the pointer.
'[' : jump forward to the command after the corresponding ']' if the byte at the pointer is zero.
']' : jump back to the command after the corresponding '[' if the byte at the pointer is nonzero.
Brainf**k programs can be translated into C using the following interpreter: http://spoj.com/bf2c.c
The program should be as small as possible of course.
Input
t – the number of lines [10 <= t <= 99]. In each of the following t lines there is one publication title consisting of several words (length of a line <= 1000 symbols, length of a word <= 40). Each line ends with the ASCII symbol '\n' = 10. Publication names consist of lower-case letters: 'a'-'z' and space: ' '.
Output
Each publication title should be placed in a separate line. Each word of the publication title should begin with an upper-case letter and there should be a dot at the end of the publication title.
Score
The score of the program is inversely proportional to its source size, i.e. score = 100/(1+R), where R stands for the source code size in bytes (only Brainf**k commands are counted, all other characters are ignored).
Example
Input: 06 joint power management of memory and disk instruction scheduling for dynamic hardware configuration hierarchical variance analysis for analog circuits based on graph modeling lifetime modeling of a sensor network symmetric multiprocessing on programmable chips made easy a time slice based scheduler model for system level design Output: Joint Power Management Of Memory And Disk. Instruction Scheduling For Dynamic Hardware Configuration. Hierarchical Variance Analysis For Analog Circuits Based On Graph Modeling. Lifetime Modeling Of A Sensor Network. Symmetric Multiprocessing On Programmable Chips Made Easy. A Time Slice Based Scheduler Model For System Level Design.
Added by: | Roman Sol |
Date: | 2005-04-05 |
Time limit: | 0.100s |
Source limit: | 20000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | BF |
Resource: | ZCon 2006 |