CSCI-101: Intro to Computer Science
Python Course


Great scientific discoveries are often named by the last names of scientists that made them. For example, the most popular asymmetric cryptography system, RSA was discovered by Rivest, Shamir and Adleman. Another notable example is the Knuth-Morris-Pratt algorithm, named by Knuth, Morris and Pratt.

Scientific papers reference earlier works a lot and it’s not uncommon for one document to use two different naming conventions: the short variation (e.g. KMP) using only the first letters of authors last names and the long variation (e.g. Knuth-Morris-Pratt) using complete last names separated by hyphens.

We find mixing two conventions in one paper to be aesthetically unpleasing and would like you to write a program that will transform long variations into short.


The first and only line of input will contain at most 100 characters, uppercase and lowercase letters of the English alphabet and hyphen (-). The first character will always be an uppercase letter. Hyphens will always be followed by an uppercase letter. All other characters will be lowercase letters.


The first and only line of output should contain the appropriate short variation.

Lab I/O Format

Your program should use the Lab Input/Output Format, as described below:

  • When prompting for input, use the prompt string WORD>, where WORD is a single, uppercase word which describes the input.
  • When providing output that will be graded, start the line with OUTPUT. Think of this as "boxing your answer" on a math worksheet, it lets us quickly find your answer. We will ignore any lines which do not start with OUTPUT.
  • You may interleave the inputs and outputs in any order you wish. For example, you might want to recieve all of your inputs (order of inputs still matters!), then print all of your outputs (order of outputs still matters!), or you might want to do input/output, input/output, etc.

Example Interaction 1

NAMES> Knuth-Morris-Pratt

Example Interaction 2

NAMES> Mirko-Slavko

Example Interaction 3

NAMES> Pasko-Patak


This problem was derived from a problem by Marko Ivanković. License is for educational use only.