当前位置:网站首页>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.
边栏推荐
猜你喜欢
PostgreSQL 2022 报告:流行度上涨,开源、可靠性和扩展是关键
gradle尚硅谷笔记
Common operations of oracle under linux and daily accumulation of knowledge points (functions, timed tasks)
PCB layout must know: teach you to correctly lay out the circuit board of the op amp
In-depth understanding of timeout settings for Istio traffic management
FPGA: Use of the development environment Vivado
5G NR 系统消息
CenOS MySQL入门及安装
TiDB 6.0 Placement Rules In SQL 使用实践
sqlserver编写通用脚本实现获取一年前日期的方法
随机推荐
发现C语言的乐趣
Chapter 5: Activiti process shunting judgment, judging to go to different task nodes
19.3 restart the Oracle environment
PostgreSQL 2022 Report: Rising popularity, open source, reliability and scaling key
nyoj86 找球号(一) set容器和二分 两种解法
【C语言指针】用指针提升数组的运算效率
什么是 DevOps?看这一篇就够了!
智能算力的枢纽如何构建?中国云都的淮海智算中心打了个样
大佬们 我是新手,我根据文档用flinksql 写个简单的用户访问量的count 但是执行一次就结束
自定义过滤器和拦截器实现ThreadLocal线程封闭
poj2935 Basic Wall Maze (2016xynu暑期集训检测 -----D题)
nyoj754 黑心医生 结构体优先队列
Go编译原理系列6(类型检查)
ECCV 2022 | 视听分割:全新任务,助力视听场景像素级精细化理解
CenOS MySQL入门及安装
lvgl 实现状态提示图标自动对齐补位显示
朴素贝叶斯
导火索:OAuth 2.0四种授权登录方式必读
[Android]如何使用RecycleView in Kotlin project
Chapter 5: Multithreaded Communication—wait and notify