A New Alphabet

题目链接:https://nanti.jisuanke.com/t/32763

解题思路:简单的字符替换,注意"\\"才是\

代码实例:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	string Replace[30] = {"@","8","(","|)","3","#","6","[-]",
	"|","_|","|<","1","[]\\/[]","[]\\[]","0","|D","(,)",
	"|Z","$","']['","|_|","\\/","\\/\\/","}{","`/","2"};
	string str;
	getline(cin,str);
	for(int i = 0;str[i];i++){
		if(isalpha(str[i])){
			str[i] = tolower(str[i]);
			cout << Replace[str[i]-'a'];
		}else	cout<<str[i];
	}
	return 0;
}

 

posted @ 2018-10-24 14:59  Dr_Lo  阅读(114)  评论(0编辑  收藏  举报