当前位置:网站首页>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-6 mixed type data format input
- 愉悦资本新双币基金近40亿元完成首次关账
- Exercise 9-1 time conversion
- PCB中常用快捷键
- Exercise 10-1 judge the three digits that meet the conditions
- Zabbix添加Calculated items后保存页面成空白
- Exercise 6-1 classify and count the number of characters
- FPGA test method takes mentor tool as an example
- 7-17 crawling worms (break exercise)
- js 2023. String pair equal to the target string after connection
猜你喜欢

Article content typesetting and code highlighting

Exercise 6-2 using functions to sum special A-string sequences
[email"/>Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email

Solution to failure or slow downloading of electron when electron uses electron builder to package

Programmable logic device software testing

Concat and concat_ Ws() differences and groups_ Use of concat() and repeat() functions

28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;

Exercise 10-2 recursive factorial sum

Interface for querying IP home

QT learning 20 standard dialog box in QT (middle)
随机推荐
QT learning 23 layout manager (II)
常见问题之PHP——ldap_add(): Add: Undefined attribute type in
小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。
How to bold text in AI
7-23 currency conversion (using array conversion)
7-17 crawling worms (break exercise)
虽然不一定最优秀,但一定是最努力的!
添加Zabbix计算类型项目Calculated items
Article content typesetting and code highlighting
Exercise 10-6 recursively find Fabonacci sequence
Reflection -- basic usage
Redis:字符串类型数据的操作命令
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
2021年区域赛ICPC沈阳站J-Luggage Lock(代码简洁)
Exercise 10-2 recursive factorial sum
Raft agreement
超简单手机地图开发
Solve the problem of dormitory router campus network sharing login
Invalid Z-index problem
QT learning 22 layout manager (I)