当前位置:网站首页>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]);
}
}
}边栏推荐
- 全文检索引擎Solr系列—–全文检索基本原理
- Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
- 7-14 sum integer segments (C language)
- Leetcode (4) -- find the median of two positively ordered arrays
- Back to top implementation
- 编程语言:类型系统的本质
- Article content typesetting and code highlighting
- JS get DPI, PX to cm, cm to PX
- 7-6 mixed type data format input
- Vite project commissioning
猜你喜欢

一文了解微分段应用场景与实现机制

Leetcode(4)——尋找兩個正序數組的中比特數

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

JVM class loading

Fabric. JS document

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

7-7 12-24 hour system

JVM runtime data area

Leetcode (4) -- find the median of two positively ordered arrays

Programmable logic device software testing
随机推荐
Strategy, tactics (and OKR)
Selenium browser (1)
GRPC的四种数据流以及案例
jvm-运行时数据区
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
别再问自己适不适合做软件测试了
Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
好看、好用、强大的手写笔记软件综合评测:Notability、GoodNotes、MarginNote、随手写、Notes Writers、CollaNote、CollaNote、Prodrafts、Noteshelf、FlowUs、OneNote、苹果备忘录
QT learning 20 standard dialog box in QT (middle)
Sendmail无法发送邮件及发送过慢解决
simpleParallax. JS (create poor visual effects for website pictures)
Exercise 10-8 recursive implementation of sequential output of integers
Redis: redis data structure and key operation commands
天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值
剑指 Offer 28. 对称的二叉树
全局事件总线
7-17 crawling worms (break exercise)
Exercise 10-1 judge the three digits that meet the conditions
Jiuyi cloud black free encryption free version source code