当前位置:网站首页>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.
边栏推荐
- The fuse: OAuth 2.0 four authorized login methods must read
- 2022 Hangzhou Electric Power Multi-School Session 6 1008.Shinobu Loves Segment Tree Regular Questions
- 2022杭电杯超级联赛(5)
- Android 开发用 Kotlin 编程语言 二 条件控制
- ECCV 2022 | 视听分割:全新任务,助力视听场景像素级精细化理解
- lvgl 实现状态提示图标自动对齐补位显示
- 智源社区AI周刊No.92:“计算复杂度”理论奠基人Juris Hartmanis逝世;美国AI学生九年涨2倍,大学教师短缺;2022智源大会观点报告发布[附下载]
- 硅谷来信:快速行动,Facebook、Quora等成功的“神器”!
- Go学习笔记(篇二)初识Go
- PostgreSQL 2022 报告:流行度上涨,开源、可靠性和扩展是关键
猜你喜欢
随机推荐
Header file search rules when compiling with GCC
Score interview (1)----related to business
Opencv图像缩放和平移
【OpenCV】-仿射变换
结合“xPlus”探讨软件架构的创新与变革
flutter 服务器返回数据判断是否为空
SkiaSharp 之 WPF 自绘 投篮小游戏(案例版)
这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
Nature:猪死亡1小时后,器官再次运转
FPGA: Basic Getting Started LED Lights Blinking
.NET深入解析LINQ框架(六:LINQ执行表达式)
FPGA: Basic Getting Started Button Controlling LED Lights
苹果Meta都在冲的Pancake技术,中国VR团队YVR竟抢先交出产品答卷
如何修改管理工具client_encoding
Go compilation principle series 6 (type checking)
STM32 entry development: write XPT2046 resistive touch screen driver (analog SPI)
FPGA:基础入门LED灯闪烁
机器学习——逻辑回归
导火索:OAuth 2.0四种授权登录方式必读
Opencv算术操作









