首页 > 试题广场 >

密码翻译

[编程题]密码翻译
  • 热度指数:26850 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
在情报传递过程中,为了防止情报被截获,往往需要对情报用一定的方式加密,简单的加密算法虽然不足以完全避免情报被破译,但仍然能防止情报被轻易的识别。我们给出一种最简的的加密方法,对给定的一个字符串,把其中从a-y,A-Y的字母用其后继字母替代,把z和Z用a和A替代,则可得到一个简单的加密字符串。

输入描述:
读取这一行字符串,每个字符串长度小于80个字符


输出描述:
对于每组数据,输出每行字符串的加密字符串。
示例1

输入

Hello! How are you!

输出

Ifmmp! Ipx bsf zpv!
示例2

输入

zzz

输出

aaa
头像 立志实干
发表于 2021-02-28 20:36:52
//这题让你加密,不是让你解密!!!!!!!!!!! //a-z和A-Z之间不是连续的,有6个标点符号 #include <iostream> #include <cstdio> #include <string> using namespace std; i 展开全文
头像 whoway
发表于 2020-12-11 20:34:20
看到样例有 1 Hello! How are you! 以为要这么输入 while( scanf("%d",&n) ) { while( n-- ) { string str; getline(cin,s 展开全文
头像 小南知更年
发表于 2024-03-13 20:22:54
#include<stdio.h> #include<algorithm> #include<string> using namespace std; int main() { char strs[81]; fgets(strs, sizeof(strs), 展开全文
头像 JavaGPT
发表于 2022-01-13 13:22:24
重点是解决输入输出问题,有些输入遇到空格就会停止读取,详情请参看我的一篇博文:https://blog.csdn.net/weixin_46294086/article/details/122466525?spm=1001.2014.3001.5501 #include <stdio.h> 展开全文
头像 aaaawei
发表于 2021-01-11 21:21:22
include include include using namespace std;int main(){ string str; while(getline(cin,str)){//循环输入一行 for(int i=0;i<str.size();++i){ 展开全文
头像 树新峰
发表于 2023-03-30 17:26:00
#include <stdlib.h> #include <stdio.h> #include <string.h> #define len 2000 char encode(char c){ if(c>='a'&&c<='z'){ 展开全文
头像 牛客861440576号
发表于 2023-02-22 11:51:20
/* 描述 在情报传递过程中,为了防止情报被截获,往往需要对情报用一定的方式加密,简单的加密算法虽然不足以完全避免情报被破译, 但仍然能防止情报被轻易的识别。我们给出一种最简的的加密方法,对给定的一个字符串,把其中从a-y,A-Y的字母用其后继字母替代, 把z和Z用a和A替代,则可得到一个简单的 展开全文
头像 牛客411701195号
发表于 2023-03-16 09:53:18
#include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char A[30] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char a[30] = "ab 展开全文
头像 正义人
发表于 2023-02-04 20:48:01
#include<iostream> #include<cstring> using namespace std; char str[81]; void translate() { int len = strlen(str); for (int i = 0; 展开全文
头像 湖畔竹影12138
发表于 2024-01-10 11:03:55
#include <iostream> #include<string> using namespace std; int main() { string s; while (getline(cin,s)) { // 注意 while 处理多个 case 展开全文

热门推荐

通过挑战的用户

查看代码