当前位置:网站首页>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]);
}
}
}
边栏推荐
- Analysis of the characteristics of page owner
- 中感微冲刺科创板:年营收2.4亿净亏1782万 拟募资6亿
- FPGA测试方法以Mentor工具为例
- QT learning 23 layout manager (II)
- Redis: redis data structure and key operation commands
- JS continues to explore...
- GRPC的四种数据流以及案例
- Solution to failure or slow downloading of electron when electron uses electron builder to package
- 7-17 crawling worms (break exercise)
- etcd集群权限管理和账号密码使用
猜你喜欢
JVM runtime data area
Generate directories from web content
Example analysis of QT learning 18 login dialog box
Exercise 6-1 classify and count the number of characters
Exercise 6-2 using functions to sum special A-string sequences
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
Solution to failure or slow downloading of electron when electron uses electron builder to package
QT learning 23 layout manager (II)
jvm-运行时数据区
Leetcode(4)——寻找两个正序数组的中位数
随机推荐
Exercise 10-3 recursive implementation of exponential functions
Global event bus
7-18 finding the single root of polynomial by dichotomy
C language,%d% Difference between 2D%2d%02d
Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
jvm-运行时数据区
修改数据库中的记录为什么报这个错
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
Redis:Redis的数据结构、key的操作命令
Exercise 6-6 use a function to output an integer in reverse order
JS matrix zero
MongoDB数据库入门的常用命令
protobuf与grpc
GRPC的四种数据流以及案例
Fabric. JS document
Similarities and differences between Allegro, OrCAD, net alias, port, off page connector and how to select them
Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
TS code automatically generates JS
Exercise 10-6 recursively find Fabonacci sequence
常见问题之PHP——ldap_add(): Add: Undefined attribute type in