南昌大学航天杯第二届程序设计竞赛校赛网络同步赛 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 }
复制代码

 



posted @   樱花落舞  阅读(447)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示