Programming contests

ECN selejtező programozó csapatverseny, 2014. április 27.

April 27, 2014 10:30 AM – April 27, 2014 3:30 PM


You have decided that PGP encryption is not strong enough for your email. You have decided to supplement it by first converting your clear text letter into Pig-Latin before encrypting it with PGP.

Input and Output Specification

You are to write a program that will take in an arbitrary number of lines of text and output it in Pig-Latin. Each line of text will contain one or more words. A “word” is defined as a consecutive sequence of letters (upper- and/or lowercase). Words should be converted to Pig-Latin according to the following rules (nonwords should be output exactly as they appear in the input):

  1. Words that begin with a vowel (a, e, i, o, or u, and the capital versions of these) should just have the string “ay” (not including the quotes) appended to it. For example, “apple” becomes “appleay”.
  2. Words that begin with a consonant (any letter that is not A, a, E, e, I, i, O, o, U, or u) should have the first consonant removed and appended to the end of the word, and then append “ay” as well. For example, “hello” becomes “ellohay”.
  3. Do not change the case of any letter.

Sample Input

  1. This is the input.
download as text file

Output for Sample Input

  1. hisTay isay hetay inputay.
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019