Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
The Dillun twins never learned PigLatin as kids. They did learn something called UNlatin though and they still use it occasionally. UNlatin is very much like PigLatin except that an "un" is used where PigLatin uses an "ay". The rules are as follows:
All input will be one word per line. When the line you read in has the word "nevermore", you stop processing.
Sample Input Data:
sample
input
data
nevermore
Sample Output:
sample becomes amplesun
input becomes inputun
data become atadun
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
Source Code for a Solution to this Problem
// preprocessor directives #include <stdio.h> #include <string.h> // string to stop for #define QUIT "nevermore" #define EOLN '\n' //typedefs typedef char STRING[257]; // prototypes int main(void) { int i,j,length = 0; STRING string1,string2; char temp; scanf("%s",string1); while( strcmp(string1,QUIT) != 0 ) { length = strlen(string1); //get length of string1 printf("%s becomes ",string1); switch(string1[0]) { case 'a': case 'e': case 'i': case 'o': case 'u' : { string1[length + 2] = '\0'; string1[length + 1] = 'n'; string1[length] = 'u'; } // case of vowels break; default : { char tmp = string1[0]; for(i = 0; i < length -1; i++) string1[i] = string1[i + 1]; string1[length] = tmp; string1[length + 1] = 'u'; string1[length + 2] = 'n'; string1[length + 3] = '\0'; } //default switch case of consonants break; } //switch printf("%s\n",string1); // printf new string in unlatin scanf("%s",string1); } // while return 0; } //main
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
sample input data nevermore
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
sample becomes amplesun input becomes inputun data becomes atadun
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
sample input data yellow a isaac kathy may woofer nevermore
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
sample becomes amplesun input becomes inputun data becomes atadun yellow becomes ellowyun a becomes aun isaac becomes isaacun kathy becomes athykun may becomes aymun woofer becomes ooferwun
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
skittles intimidator winners rumple deaddrive stretches training accomplish a workpad snton@lsu.edu nevermore
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
skittles becomes kittlesssun intimidator becomes intimidatorun winners becomes innersswun rumple becomes umpleerun deaddrive becomes eaddriveedun stretches becomes tretchesssun training becomes raininggtun accomplish becomes accomplishun a becomes aun workpad becomes orkpaddwun snton@lsu.edu becomes nton@lsu.eduusun
Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.
Return to the LSU High School Programming Contest Homepage