版权声明:个人笔记,仅供复习 https://blog.csdn.net/weixin_41162823/article/details/83344132
题目链接: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;
}