Poj Solution 3749

http://poj.org/problem?id=3749

#include<stdio.h>
#include<string.h>
int main()
{
    void translate(char word[]);
    char start[20];
    char end[20];
    char word[205];

    while(1)
    {
        gets(start);
        if(strcmp(start,"START")!=0) break;
        gets(word);
        translate(word);
        puts(word);
        gets(end);
    }

}

void translate(char word[])
{
    int i,len;
    len=strlen(word);
    for(i=0;i<len;i++)
    {
        if(word[i]>='A'&&word[i]<='E')
        {
            word[i]+=21;
        }
        else if(word[i]>='F'&&word[i]<='Z')
        {
            word[i]-=5;
        }
    }
}
											
This entry was posted in poj. Bookmark the permalink.