当前位置:网站首页>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.
边栏推荐
- 【MySQL基础】-【数据处理之增删改】
- 四、kubeadm单master
- #yyds干货盘点#JS数组和树相互转化
- This notebook of concurrent programming knowledge points strongly recommended by Ali will be a breakthrough for you to get an offer from a big factory
- 字节一面:TCP 和 UDP 可以使用同一个端口吗?
- Latex如何控制表格的宽度和高度
- 问题征集丨ECCV 2022中国预讲会 · Panel专题研讨会
- nyoj754 黑心医生 结构体优先队列
- 这份阿里强推的并发编程知识点笔记,将是你拿大厂offer的突破口
- SkiaSharp 之 WPF 自绘 投篮小游戏(案例版)
猜你喜欢

PostgreSQL 2022 Report: Rising popularity, open source, reliability and scaling key

什么是 DevOps?看这一篇就够了!

FPGA:开发环境Vivado的使用

《分布式云最佳实践》分论坛,8 月 11 日深圳见

化繁为简!阿里新产亿级流量系统设计核心原理高级笔记(终极版)

Microcontroller: temperature control DS18B20

Opencv图像缩放和平移

微服务结合领域驱动设计落地

DocuWare平台——文档管理的内容服务和工作流自动化的平台详细介绍(下)

PCB layout must know: teach you to correctly lay out the circuit board of the op amp
随机推荐
数据可视化(一)
【AGC】增长服务1-远程配置示例
如何测试一下现场的备机失败,转发主机的场景?
Go编译原理系列6(类型检查)
RT-Thread记录(一、RT-Thread 版本、RT-Thread Studio开发环境 及 配合CubeMX开发快速上手)
反射修改jsessionid实现Session共享
FPGA:基础入门LED灯闪烁
Go compilation principle series 6 (type checking)
The query that the user's test score is greater than the average score of a single subject
GCC编译的时候头文件搜索规则
【翻译】混沌网+SkyWalking:为混沌工程提供更好的可观察性
5G NR 系统消息
朴素贝叶斯
trie树模板
FPGA: Use of the development environment Vivado
Header file search rules when compiling with GCC
2022 Hangzhou Electric Power Multi-School Session 6 1008.Shinobu Loves Segment Tree Regular Questions
MMDetection实战:MMDetection训练与测试
智能算力的枢纽如何构建?中国云都的淮海智算中心打了个样
This notebook of concurrent programming knowledge points strongly recommended by Ali will be a breakthrough for you to get an offer from a big factory