D. Master of Shuangpin
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

As you know, there are three kinds of Chinese input methods commonly used: Wubi, Pinyin and Shuangpin. With Shuangpin, you can type any Chinese word by pressing keys only twice.

[h]

Pinyin Sequence Pinyin Sequence
q, iu q f, en f
w, ei w g, eng g
e e h, ang h
r, uan r j, an j
t, ue t k, uai, ing k
y, un y l, uang, iang l
u, sh u z, ou z
i, ch i x, ia, ua x
o, uo o c, ao c
p, ie p v, zh, ui v
a a b, in b
s, ong, iong s n, iao n
d, ai d m, ian m

Attention that:

  • For pinyin of length 1, you should repeat it in order to meet the conditions.
  • For those of length 2, just output the original pinyin.
  • For pinyin such as ang, you should press the first character of it and then look up this whole pinyin in the table for the second key.
  • For simplification, there is no character v in any input. We believe that you, a Pinyin master, can tell u and v in any situations such as lve and que, so we do not challenge you here.

OK, now you are already a MASTER of Shuangpin! Please output the keys sequence to type the given sentences. For example, "ni hao shi jie" will be "ni hc ui jp".

Input

There are multiple test cases. Each line contains one.

Each line is a sequence of pinyin separated by spaces.

It is guaranteed that the number of test case is no more than 1000, the number of pinyin in one test case is no more than 500, and the number of pinyin in all the test cases is no more than 5000.

Output

The keys sequence separated by spaces.

Examples
input
rua
ni xian qi po lan
rang wo men dang qi shuang jiang
cha na zhua zhu le wei lai
zhe ti mian shen me wan yi
output
rx
ni xm qi po lj
rh wo mf dh qi ul jl
ia na vx vu le ww ld
ve ti mm uf me wj yi
input
ni you ben shi na lai mai a
wo e le wo men chi shen me
ang yang de dou zhi
output
ni yz bf ui na ld md aa
wo ee le wo mf ii uf me
ah yh de dz vi

代码实现:

#include<iostream>
#include<algorithm>
#include<cstring>
#include<unordered_map>
using namespace std;
#define int long long
unordered_map<string,char>mp;
void init(){
mp["iu"]='q',mp["ei"]='w',mp["uan"]='r',mp["ue"]='t',mp["un"]='y',mp["sh"]='u',mp["ch"]='i';
mp["uo"]='o',mp["ie"]='p',mp["ong"]='s',mp["iong"]='s',mp["ai"]='d',mp["en"]='f',mp["eng"]='g';
mp["ang"]='h',mp["an"]='j',mp["uai"]='k',mp["ing"]='k',mp["uang"]='l',mp["iang"]='l',mp["ou"]='z';
mp["ia"]='x',mp["ua"]='x',mp["ao"]='c',mp["zh"]='v',mp["ui"]='v',mp["in"]='b',mp["iao"]='n',mp["ian"]='m';
char c='a';
for(int i=0;i<26;i++){
string s="";
s+=c;
mp[s]=c;
c=c+1;
}
}
signed main(){
string s;
init();
while(cin>>s){
if(s.size()==1)cout<<s<<s;
else if(s.size()==2)cout<<s;
else{
if(mp.find(s)!=mp.end())cout<<s[0]<<mp[s];
else{
for(int i=1;i<s.size();i++){
string s1=s.substr(0,i);
string s2=s.substr(i);
if(mp.find(s1)!=mp.end()&&mp.find(s2)!=mp.end()){
cout<<mp[s1]<<mp[s2];
}
}
}
}
char c=getchar();
cout<<c;
}
return 0;
}

HDU - 7125 Master of Shuangpin的更多相关文章

  1. HDU 6273.Master of GCD-差分数组 (2017中国大学生程序设计竞赛-杭州站-重现赛(感谢浙江理工))

    Super-palindrome 题面地址:http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf 这道题是差分数组的题目,线 ...

  2. 算法学习分析-点分治 HDU 6269 Master of Subgraph

    首先给出定义 点分治是一种处理树上路径的工具 挂出一道题目来:Master of Subgraph 这道题目让你求所有联通子图加和所能产生数字,问你1到m之间,那些数字可以被产生 这道题目,假如我们利 ...

  3. HDU 6271 Master of Connected Component(2017 CCPC 杭州 H题,树分块 + 并查集的撤销)

    题目链接  2017 CCPC Hangzhou Problem H 思路:对树进行分块.把第一棵树分成$\sqrt{n}$块,第二棵树也分成$\sqrt{n}$块.    分块的时候满足每个块是一个 ...

  4. HDU 6268 Master of Subgraph (2017 CCPC 杭州 E题,树分治 + 树上背包)

    题目链接  2017 CCPC Hangzhou  Problem E 题意  给定一棵树,每个点有一个权值,现在我们可以选一些连通的点,并且把这点选出来的点的权值相加,得到一个和. 求$[1, m] ...

  5. HDU 6274 Master of Sequence (暴力+下整除)

    题意 两个1e5的数组a,b,定义\(S(t)=\left \lfloor \frac{t-b_i}{a_i} \right \rfloor\),有三个操作 1 x y:将\(a[x]\)变为\(y\ ...

  6. hdu 6268 Master of Subgraph(点分治+bitset)

    You are given a tree with n nodes. The weight of the i-th node is wi. Given a positive integer m, no ...

  7. HDU 5016 Mart Master II

    Mart Master II Time Limit: 6000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ...

  8. HDU 5308 I Wanna Become A 24-Point Master

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5308 题面: I Wanna Become A 24-Point Master Time Limit ...

  9. HDU 5900 QSC and Master 区间DP

    QSC and Master Problem Description   Every school has some legends, Northeastern University is the s ...

  10. hdu 5540 Secrete Master Plan(水)

    Problem Description Master Mind KongMing gave Fei Zhang a secrete master plan stashed × matrix, but ...

随机推荐

  1. 痞子衡嵌入式:MCUBootUtility v2.3.1发布,解决了长久以来非空flash可能无法下载的问题

    -- 痞子衡维护的NXP-MCUBootUtility工具距离上一个版本(v2.3)发布过去3个月了,这一次痞子衡为大家带来了小版本升级v2.3.1(第一次做x.y.z中z级别更新),这个版本主要有两 ...

  2. Android进度表示

    在连接上数据库之后,一切都变得简单了呢! 开心,很轻松地就能够将APP里面的相关内容写完啦! 尝试了好久的连接Mysql数据库,最后还是没有成功: 虽然Android studio里面自带的SQLit ...

  3. Java Swing的练习感悟

    感悟心得 这还是我第一次使用Java Swing写代码呢,直接就是趣味性拉满! 在相关的界面代码的基础上,在必要的位置嵌入Java代码,就可以很好的实现啦! 简单的嘞! (有兴趣的各位可以选择去浅浅地 ...

  4. ArchLinux 作业系统安装教程

    如果你能看到此文,想必你一定玩过不少的发行商发行的 Linux 作业系统或者听说过很多发行商发行的 Linux 作业系统.如果你玩过不少的 Linux 作业系统,对于安装系统可谓是轻车熟路,就是闭着眼 ...

  5. CSharp读写world文档数据

    背景 在工作中需要对比数据,然后输出一份world文档的对比报告.这需要用C#来读写world文件. 用到的工具 NPOI NPOI 地址:NPOI NPOI版本:2.6.0 个人项目的运行时版本:. ...

  6. 选择KV数据库最重要的是什么

    本文分享自华为云社区<选择KV数据库最重要的是什么?>,作者:GaussDB 数据库 . 经常有客户提到KV数据库,但却偏偏"不要Redis".比如有个做安全威胁分析平 ...

  7. NetCore 使用 Swashbuckle 搭建 SwaggerHub

    什么是SwaggerHub? Hub 谓之 中心, 所以 SwaggerHub即swagger中心. 什么时候需要它? 通常, 公司都拥有多个服务, 例如商品服务, 订单服务, 用户服务, 等等, 每 ...

  8. 二进制安装Kubernetes(k8s) v1.23.6

    二进制安装Kubernetes(k8s) v1.23.6 背景 kubernetes二进制安装 1.23.3 和 1.23.4 和 1.23.5 和 1.23.6 文档以及安装包已生成. 后续尽可能第 ...

  9. python文字转语音库及使用方法

    作者:陈哲链接:https://www.zhihu.com/question/473797102/answer/2019063801来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...

  10. 我来泼盆冷水:正面迎击AI的时代千万别被ChatGPT割了韭菜

    前言 ChatGPT从出来的时候我就一直密切关注,为此还加了不少群,用了不少套壳的程序,公司还开了专门的培训会,技术团队还为此搭建了接入ChatGPT的服务,帮助全公司的产品.商务.测试.运维.研发一 ...