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

更短一些。。。

Posted by lithum at 2009-08-09 17:51:15 on Problem 2141
In Reply To:简短 Posted by:zlinhua at 2009-02-27 19:43:16
#include<iostream>
using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	char key[30];
	char str[90];
	memset(str,'\0',sizeof(str));
	gets(key);
	gets(str);
	int i;
	int n=strlen(str);
	for(i=0;i<n;i++)
	{
		if('a'<=str[i] && str[i]<='z') str[i]=key[int(str[i]-'a')];
		if('A'<=str[i] && str[i]<='Z') str[i]=char(key[int(str[i]-'A')]+'A'-'a');
	}
	cout<<str<<endl;
	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