11398 - Pig-Latin (string practice)   

Description

You have decided that PGP encryptation 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.

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 lower case). Words should be converted to Pig Latin according to the following rules (non-words 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 than 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 appending “ay” as well. For example, “hello” becomes “ellohay”.

3. Do not change the case of any letter. 

4. The above rules are gived from origin problem in uva, and we add a addition rule: we will give you strings s1 and s2, please replace s1 with s2 in the beginning.

 

c++ string document: http://en.cppreference.com/w/cpp/string/basic_string

Input

The first and second lines are s1 and s2.

And then the input will be an arbitrary number of lines of text.Each line of text will contain one or more words.

Output

You are asked to replace s1 with s2 in the beginning and output it in Pig Latin (follow the rules 1, 2, and 3).

Each output line has newline in the end.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

11398.cpp

Partial Judge Header

11398.h

Tags




Discuss