南昌大学航天杯第二届程序设计竞赛校赛网络同步赛 A

链接:https://www.nowcoder.com/acm/contest/122/A
来源:牛客网

题目描述

Users prefer simple passwords that are easy to remember, but such passwords are often insecure. Some sites use random computer-generated passwords, but users have a hard time remembering them. But today I improved the website system, which greatly reduced the probability of password being cracked. So we can generate a simple password for each ID by default.
Each id has its initial password.
Do the following two jobs at the same time:
1.Turn uppercase letters to lowercase letters
2.Turn lowercase letters to uppercase letters
You can get the initial password for the id.

输入描述:

The input consists of one or more identities(ID), one per line.
The length of each id is between 1 and 100. Each id only consists of letters and digits.

输出描述:

For each id, output the corresponding initial password.
示例1

输入

JDJhadjsazA
ksfjkkdSDJ23

输出

jdjHADJSAZa
KSFJKKDsdj23

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cmath>
 4 #include<cstring>
 5 using namespace std;
 6 #define maxn 2000
 7 
 8 int main()
 9 {
10     string s;
11     while(cin>>s){
12         for(int i=0;i<s.length();i++){
13             if(s[i]>='a'&&s[i]<='z'){
14                 printf("%c",s[i]-32);
15             }else if(s[i]>='A'&&s[i]<='Z'){
16                 printf("%c",s[i]+32);
17             }else{
18                 printf("%c",s[i]);
19             }
20         }
21         printf("\n");
22     }
23     return 0;
24 }

 



转载于:https://www.cnblogs.com/yinghualuowu/p/9063308.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值