Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Why WA???Help

Posted by Rossi at 2009-02-28 22:25:14 on Problem 2141
#include<stdio.h>
#include<string.h>
int sum(int);
int main(void)
{
  int i,flag=0;
  char key[26],message[100];
  gets(key);
  gets(message);
  if(message[0]>='A'&&message[0]<='Z')
  {
    message[0]+=32;
    flag=1;
  }
  for(i=0;i<strlen(message);i++)
  {
    if(message[i]==' ')
    {
      printf(" ");
      continue;
    }
    if(i!=0)printf("%c",key[message[i]-'a']);
    else printf("%c",(flag==1)?key[message[i]-'a']-32:key[message[i]-'a']);
  }
  return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator