当前位置:网站首页>1137: encrypted medical record
1137: encrypted medical record
2022-06-30 14:49:00 【I would, I think】
Method 1 :
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
if(a[i]=='x')
{
b[i]='a';
}
else if(a[i]=='y')
{
b[i]='b';
}
else if(a[i]=='z')
{
b[i]='c';
}
else if(a[i]=='X')
{
b[i]='A';
}
else if(a[i]=='Y')
{
b[i]='B';
}
else if(a[i]=='Z')
{
b[i]='C';
}
else
{
b[i]=a[i]+3;
}
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)
{
c[i]=c[i]+32;
}
else
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
}Method 2 : use switch...case
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
switch(a[i])
{
case 'x':
b[i]='a';
break;
case 'y':
b[i]='b';
break;
case 'z':
b[i]='c';
break;
case 'X':
b[i]='A';
break;
case 'Y':
b[i]='B';
break;
case 'Z':
b[i]='C';
break;
default:
b[i]=a[i]+3;
}
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)
{
c[i]=c[i]+32;
}
else
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
}Method 3 : Minimalist
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
char a[500];
char b[500];
char c[500];
cin.getline(a,500);
for(int i=0;i<strlen(a);i++)
{
if((a[i]>='x'&&a[i]<='z')||(a[i]>='X')&&a[i]<='Z')
{
b[i]=a[i]-23;//x,y,z Three elements move right 3 The situation of the first position
}
else
b[i]=a[i]+3;
}
for(int i=0;i<strlen(a);i++)
{
c[i]=b[strlen(a)-1-i];// The reverse : The first and the last are interchangeable ; The second and penultimate are interchanged
}
for(int i=0;i<strlen(a);i++)
{
if(c[i]>=65&&c[i]<=90)// Capital Add 32 Change to lowercase
{
c[i]=c[i]+32;
}
else// Lowercase letters
{
c[i]=c[i]-32;
}
}
for(int i=0;i<strlen(a);i++)
{
cout<<c[i];
}
return 0;
} 边栏推荐
- Knowledge learned from the water resources institute project
- 中信期货开户麻烦吗安全吗,期货开户手续费是多少,能优惠吗
- Data recovery software easyrecovery15 Download
- PS cutting height 1px, Y-axis tiling background image problem
- org. json. The jsonobject object is converted to JSON, and JSON adds new elements. The value is obtained according to the JSON key. And list object format string to jsonarray
- How to realize selective screen recording for EV screen recording
- Minimum covering substring of two pointers
- [extensive reading of papers] a delicious recipe analysis framework for exploring multi modal recipes with variable attributes
- ThinkPHP show method parameter controllable command execution
- [extensive reading of papers] multi modal sarcasm detection and human classification in code mixed conversations
猜你喜欢

August 24, 2021 deque queue and stack

Svn password forgetting solution

Ctfshow getting started with the web (ThinkPHP topic)

JS to realize simple lottery function
![[buuctf] [actf2020 freshman competition]exec1](/img/af/22051a5feb3c1f6d7201a483bde127.jpg)
[buuctf] [actf2020 freshman competition]exec1
![[geek challenge 2019] PHP problem solving record](/img/bf/038082e8ee1c91eaf6e35add39f760.jpg)
[geek challenge 2019] PHP problem solving record

@PathVariable

CCF string matching (Full Score code + problem solving ideas + skill summary) March 3, 2014
[email protected][])"/>NoViableAltException([email protected][])

Component communication mode
随机推荐
K high frequency elements before sorting
PHP conditional operator
2021-05-12
浅析卧式加工中心上不规则台阶孔存在问题
Finding the median of two arrays by dichotomy
@Role of ResponseBody
IO interview questions
數據恢複軟件EasyRecovery15下載
DiceCTF - knock-knock
Effect of shadow around the block after mouse over
Searching for single element in dichotomy
[extensive reading of papers] sentimental analysis of online reviews with a hierarchical attention network
Querywrapper in mybaits plus
Error on datetime when importing SQL file from MySQL
CCF string matching (Full Score code + problem solving ideas + skill summary) March 3, 2014
CCF drawing (full mark code + problem solving ideas + skill summary) February 2, 2014
@Component use cases
2021-08-05 leetcode notes
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
Distributed -- openresty+lua+redis