Girls Invitational '18 S1 - Biology Cheat Sheet

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type

Viraj wants to become a computer scientist. However, his parents are forcing him to take biology — a course he definitely does not want to take! A week before the biology exam, Viraj's teacher gives each student one piece of paper. Students are allowed to write whatever they want on it and then proceed to use the paper on the final exam as a "cheat sheet". Viraj, knowing he needs to fit as much information on this paper as possible, devises a plan. He first writes out a section of the textbook needed for the exam. Then, he translates it onto his cheat sheet using a shortening method. How it works: Viraj simply rewrites the textbook words. However, for every repeated word, rather than rewriting the word, he writes the index (starting at 1) of the first occurrence of that word.

Input Specification

The first line of input will be the information from the textbook, S (0 < |S| \le 3000). Note that there will not be a space, comma, or period at the front of a passage from the textbook and there will be no double spaces, commas, or periods in between words.

Output Specification

Output the words Viraj will write on this cheat sheet. If the word is being written out fully, it must match the case of the original. If the word is being repeated, the case does not need to match the first occurrence for it to be "translated" into a number. If a word ends with a period or comma attached, the period or comma should be added directly to the translated message, but should not be included as part of the word itself.

Sample Input 1

The mitochondria is the powerhouse of the cell. They reside in the cytoplasm of the cell and they generate ATP.

Sample Output 1

The mitochondria is 1 powerhouse of 1 cell. They reside in 1 cytoplasm 6 1 8 and 9 generate ATP.

Sample Input 2

The promoter indicates where the RNAP should start and it determines which of the two DNA strands is used as a template. The RNAP binds to the promoter and once the RNAP and promoter are attached, the two DNA strands unwind and transcription begins. Keep in mind, the promoters location is generally further away when dealing with a prokaryote.

Sample Output 2

The promoter indicates where 1 RNAP should start and it determines which of 1 two DNA strands is used as a template. 1 6 binds to 1 2 9 once 1 6 9 2 are attached, 1 15 16 17 unwind 9 transcription begins. Keep in mind, 1 promoters location 18 generally further away when dealing with 21 prokaryote.

Comments


  • 1
    MstrPikachu  commented on Jan. 3, 2019, 1:04 p.m.

    The sample input is grammatically incorrect