当前位置:网站首页>String substitution
String substitution
2022-07-03 14:15:00 【Study hard 867】
This question requires the preparation of procedures , Replace the uppercase letters in the given string according to the following corresponding rules :
| Original letter | The corresponding letters |
|---|---|
| A | Z |
| B | Y |
| C | X |
| D | W |
| … | … |
| X | C |
| Y | B |
| Z | A |
Input format :
The input gives no more than 80 Characters 、 A string that ends with a carriage return .
Output format :
The output gives the string after replacement in one line .
sample input :
Only the 11 CAPItaL LeTtERS are replaced.
sample output :
Lnly the 11 XZKRtaO OeGtVIH are replaced.Code :
#include <stdio.h>
int main(){
char a[26],b[80],c[26];
int i,j,num;
for(i=0;(b[i]=getchar())!='\n';i++);
num=i;
for(i=0;i<=25;i++){
a[i]='Z'-i;
c[i]='A'+i;
}
for(i=0;i<num;i++){
if(b[i]>='A'&&b[i]<='Z'){
for(j=0;j<=25;j++){
if(b[i]==c[j])printf("%c",a[j]);
}
}
else {
printf("%c",b[i]);
}
}
}边栏推荐
- 7-10 calculate salary
- 7-18 finding the single root of polynomial by dichotomy
- 剑指 Offer 28. 对称的二叉树
- 适用于XP的DDK
- Solve the problem of dormitory router campus network sharing login
- 常见问题之PHP——ldap_add(): Add: Undefined attribute type in
- Too many files with unapproved license
- JS input number and standard digit number are compared. The problem of adding 0 to 0
- Redis:字符串类型数据的操作命令
- Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(
猜你喜欢

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

protobuf与grpc

Mysql多表查询 #子查询
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;

JVM class loading

常见问题之PHP——ldap_add(): Add: Undefined attribute type in

QT learning 19 standard dialog box in QT (top)
![[clean up the extraordinary image of Disk C]](/img/0d/331115bc5d82d6337ae975a08494b2.jpg)
[clean up the extraordinary image of Disk C]

Exercise 9-1 time conversion
随机推荐
Global event bus
Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
jvm-运行时数据区
Why don't I have a rookie medal
GRPC的四种数据流以及案例
Exercise 10-8 recursive implementation of sequential output of integers
Fabric. JS document
编程语言:类型系统的本质
C language,%d% Difference between 2D%2d%02d
添加Zabbix计算类型项目Calculated items
超简单手机地图开发
Exercise 6-6 use a function to output an integer in reverse order
Solution to failure or slow downloading of electron when electron uses electron builder to package
protobuf与grpc
Facebook 如何将 Instagram 从 AWS 搬到自己的服务器
QT learning 20 standard dialog box in QT (middle)
1px problem of mobile terminal
Redis:Redis的数据结构、key的操作命令
simpleParallax. JS (create poor visual effects for website pictures)
Raft 协议