1999 LSU Computer Science High School Programming Contest
Novice and Veteran Problem 3
UNlatin

Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Problem Statement

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:

  1. If the word starts with a consonant, the consonant is moved to the end of the word and an "un" is appended to the word.
  2. If the word starts with a vowel, you simply append "un" to the end of the word.

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.


Clarifications:







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

sample
input
data
nevermore

Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Sample Output

sample becomes amplesun
input becomes inputun
data becomes atadun

Return to the Top of Page, First Page, Novice Problem Set, or Veteran Problem Set.


Judge Data Set 1 - Input

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.


Judge Data Set 1 - Output

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.


Judge Data Set 2 - Input

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.


Judge Data Set 2 - Output

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.



The statements and opinions included in these pages are those of the LSU High School Programming Contest Staff only. Any statements and opinions included in these pages are not those of Louisiana State University or the LSU Board of Supervisors.
© 1999 LSU High School Programming Contest

Return to the LSU High School Programming Contest Homepage