当前位置:网站首页>hdu4545 Magic String
hdu4545 Magic String
2022-08-05 10:58:00 【51CTO】
魔法串
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 1846 Accepted Submission(s): 692
Problem Description
Xiao Ming and his good friend Xiao Xi are playing a new game,A string consisting of lowercase letters is given by Konishi,Xiaoming gives another string that is longer than Xiaoxi,Also consists of lowercase letters,If you can make Xiaoming's string and Xiaoxi's become the same through magic conversion,那么他们两个人都会很开心.The magic here means that Xiaoming's string can arbitrarily delete a character,Or change some characters against the character change table.如:
Konishi's string is abba;
Xiao Ming's string is addba;
character change table d b (表示d能转换成b).
Then Xiao Ming can delete the firstd,然后将第二个d转换成bThe string into aabba.
Now please help to judge:Can they make the strings of two people the same through magic transformation??
Input
首先输入T,表示总共有T组测试数据(T <= 40).
接下来共T组数据,Enter the string of Xiaoxi in the first line of each set of data,Enter Xiao Ming's string on the second line(The data guarantees that the string length does not exceed1000,The length of Xiaoming's string is greater than or equal to Xiaoxi's,And all characters are in lowercase).Then enter the alphabet,先输入m,表示有mcharacter transformation(m< = 100),接着mEnter two lowercase letters per line,Indicates that the previous one can become the next one(It doesn't mean the latter can become the former).
Output
对于每组数据,先输出Case数.
If two people's strings could be made the same through magic transformation,输出“happy”,
否则输出“unhappy”.
每组数据占一行,具体输出格式参见样例.
Sample Input
2 abba addba 1 d b a dd 0
Sample Output
Case #1: happy Case #2: unhappy
Recommend
liuyiding | We have carefully selected several similar problems for you
Statistic |
Submit |
Discuss |
Note
classmates asked me.Changed according to her code.
边栏推荐
猜你喜欢
随机推荐
2022技能大赛训练题:交换机snmp配置
SQL外连接之交集、并集、差集查询
FPGA: Basic Getting Started Button Controlling LED Lights
Use KUSTO query statement (KQL) to query LOG on Azure Data Explorer Database
Microcontroller: temperature control DS18B20
智能算力的枢纽如何构建?中国云都的淮海智算中心打了个样
支持向量机SVM
SMB + SMB2: Accessing shares return an error after prolonged idle period
产品太多了,如何实现一次登录多产品互通?
UDP通信
图像分割模型——segmentation_models_pytorch和albumentations 组合实现多类别分割
【名词】什么是PV和UV?
如何用Golang来手写一个Blog - Milu.blog 开发总结
Login function and logout function (St. Regis Takeaway)
[Translation] Chaos Net + SkyWalking: Better observability for chaos engineering
自定义过滤器和拦截器实现ThreadLocal线程封闭
双因子与多因子身份验证有什么区别?
DocuWare平台——文档管理的内容服务和工作流自动化的平台详细介绍(下)
微信小程序标题栏封装
Three methods for extracting facial features