Kattis-A New Alphabet

题目所述基本内容

A New Alphabet has been developed for Internet communications. While the glyphs of the new alphabet don’t necessarily improve communications in any meaningful way, they certainly make us feel cooler.

You are tasked with creating a translation program to speed up the switch to our more elite New Alphabet by automatically translating ASCII plaintext symbols to our new symbol set.

The new alphabet is a one-to-many translation (one character of the English alphabet translates to anywhere between 1 and 6 other characters), with each character translation as follows:

Original

New

English Description

Original

New

English Description

a

@

at symbol

n

[]\[]

brackets, backslash, brackets

b

8

digit eight

o

0

digit zero

c

(

open parenthesis

p

|D

bar, capital D

d

|)

bar, close parenthesis

q

(,)

parenthesis, comma, parenthesis

e

3

digit three

r

|Z

bar, capital Z

f

#

number sign (hash)

s

$

dollar sign

g

6

digit six

t

']['

quote, brackets, quote

h

[-]

bracket, hyphen, bracket

u

|_|

bar, underscore, bar

i

|

bar

v

\/

backslash, forward slash

j

_|

underscore, bar

w

\/\/

four slashes

k

|<

bar, less than

x

}{

curly braces

l

1

digit one

y

`/

backtick, forward slash

m

[]\/[]

brackets, slashes, brackets

z

2

digit two

For instance, translating the string “Hello World!” would result in:

[-]3110 \/\/0|Z1|)!

Note that uppercase and lowercase letters are both converted, and any other characters remain the same (the exclamation point and space in this example).

输入输出样例

Input

Input contains one line of text, terminated by a newline. The text may contain any characters in the ASCII range 32–126 (space through tilde), as well as 9 (tab). Only characters listed in the above table (A–Z, a–z) should be translated; any non-alphabet characters should be printed (and not modified). Input has at most 10000 characters.

Output

Output the input text with each letter (lowercase and uppercase) translated into its New Alphabet counterpart.

 

代码

#include<iostream>
#include<string>
using namespace std;

int main() {
	string a;
	getline(cin, a);
	for (int i = 0; i < a.length(); i++) {
        if (a[i] == 'a' || a[i] == 'A') cout << "@";
        else if (a[i] == 'b' || a[i] == 'B') cout << "8";
        else if (a[i] == 'c' || a[i] == 'C') cout << "(";
        else if (a[i] == 'd' || a[i] == 'D') cout << "|)";
        else if (a[i] == 'e' || a[i] == 'E') cout << "3";
        else if (a[i] == 'f' || a[i] == 'F') cout << "#";
        else if (a[i] == 'g' || a[i] == 'G') cout << "6";
        else if (a[i] == 'h' || a[i] == 'H') cout << "[-]";
        else if (a[i] == 'i' || a[i] == 'I') cout << "|";
        else if (a[i] == 'j' || a[i] == 'J') cout << "_|";
        else if (a[i] == 'k' || a[i] == 'K') cout << "|<";
        else if (a[i] == 'l' || a[i] == 'L') cout << "1";
        else if (a[i] == 'm' || a[i] == 'M') cout << "[]\\/[]";
        else if (a[i] == 'n' || a[i] == 'N') cout << "[]\\[]";
        else if (a[i] == 'o' || a[i] == 'O') cout << "0";
        else if (a[i] == 'p' || a[i] == 'P') cout << "|D";
        else if (a[i] == 'q' || a[i] == 'Q') cout << "(,)";
        else if (a[i] == 'r' || a[i] == 'R') cout << "|Z";
        else if (a[i] == 's' || a[i] == 'S') cout << "$";
        else if (a[i] == 't' || a[i] == 'T') cout << "']['";
        else if (a[i] == 'u' || a[i] == 'U') cout << "|_|";
        else if (a[i] == 'v' || a[i] == 'V') cout << "\\/";
        else if (a[i] == 'w' || a[i] == 'W') cout << "\\/\\/";
        else if (a[i] == 'x' || a[i] == 'X') cout << "}{";
        else if (a[i] == 'y' || a[i] == 'Y') cout << "`/";
        else if (a[i] == 'z' || a[i] == 'Z') cout << "2";
        else cout << a[i];
	}
}

结束语

好兄弟好兄弟,留下你的关注和点赞,666走一波!!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

做一个AC梦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值