文章

55

粉丝

57

获赞

11

访问

10.8k

头像
密码翻译 题解:
P1179 北京大学/湖南大学机试题
发布于2024年3月24日 20:24
阅读数 126

#include<iostream>
#include<string>
using namespace std;

int main(){
	string str;
	while(getline(cin,str)){
		int len = str.length();
		for(int i = 0; i < len; i++){
			if(str[i] >= 'a' && str[i] <='z'){
				str[i] = ((str[i]-'a' + 1)%26)+97;
			}else if(str[i] >= 'A' && str[i] <='Z'){
				str[i] = ((str[i]-'A'+1)%26)+65;
			}
		}	
		cout<<str;
	}
}
 
 
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发