当前位置:网站首页>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]);
}
}
}边栏推荐
- Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
- 修改数据库中的记录为什么报这个错
- 7-15 calculation of PI
- Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值
- Leetcode(4)——尋找兩個正序數組的中比特數
- 超简单手机地图开发
- JVM garbage collector
- Leetcode(4)——寻找两个正序数组的中位数
- 天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
- C language,%d% Difference between 2D%2d%02d
猜你喜欢

Exercise 8-8 moving letters

Redis:Redis的数据结构、key的操作命令

JS Part III

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

The small project (servlet+jsp+mysql+el+jstl) completes a servlet with login function, with the operation of adding, deleting, modifying and querying. Realize login authentication, prevent illegal log

556. 下一个更大元素 III

TS code automatically generates JS

Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(

Similarities and differences between Allegro, OrCAD, net alias, port, off page connector and how to select them

allegro,orcad, net alias,port,off-page connector之间的异同点和如何选取
随机推荐
Redis:Redis的数据结构、key的操作命令
JS matrix zero
FPGA test method takes mentor tool as an example
Configure stylelint
1px problem of mobile terminal
jvm-运行时数据区
7-23 currency conversion (using array conversion)
八大排序
Metal organic framework MOFs loaded with non steroidal anti-inflammatory drugs | zif-8 wrapped Prussian blue loaded quercetin (preparation method)
添加Zabbix计算类型项目Calculated items
7-2 and then what time (15 minutes)
修改数据库中的记录为什么报这个错
Webpage connection database ~ simple implementation of addition, deletion, modification and query complete code
Global event bus
Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
Article content typesetting and code highlighting
7-9 find a small ball with a balance
QT learning 23 layout manager (II)
Vite project commissioning
JVM class loading