南昌大学航天杯第二届程序设计竞赛校赛网络同步赛 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.
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 }
分类:
某些比赛
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 从 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的设计差异
· 三行代码完成国际化适配,妙~啊~