当前位置:网站首页>Hermit crab and anemone
Hermit crab and anemone
2022-07-19 06:54:00 【winkiii】
describe
Hermit crab and anemone are a pair of cooperative symbiotic partners . Anemone is the most competent guard of hermit crab . It uses poisonous tentacles to sting all animals that dare to come close to them , Protect hermit crabs . And the hermit crab carries the sea anemone with difficulty in action , Go out looking for food , share each other's fortunes . But not all hermit crabs and anemones can be partners . It depends on whether the anemone's body conforms to the shell of the hermit crab . The anemone's body is wrinkled , The shell of the hermit crab is also uneven , We can use a string of uppercase letters to indicate their high and low levels , among A representative 0,B representative 1, By analogy . We call the sum of the two equal 25 Even if it is consistent , such as A and Z consistent ,B And Y Coincide , By analogy . As long as the sequence of the body part of the anemone is consistent with the sequence of the shell of the hermit crab , Say they can live together . such as : 1. The folds of anemones are "ABCDEFG", Hermit crab yes "ZYXWVUT". such , They can completely match . 2. The folds of anemones are "AHBICJDKELFMGN", Hermit crab yes "ZYXWVUT". such , Hermit crabs can be part of the sequence with sea anemones "ABCDEFG" consistent ( Be careful : Some sequences do not change the original sequence of characters , such as "ACB" It's not part of its sequence ). 3. The folds of anemones are "ABCD", Hermit crab yes "ZYXWVUT". such , Although the anemone can completely match the front section of the hermit crab , But it is smaller than the hermit crab , Can not completely protect the safety of hermit crabs , All of them are unsuitable . 4. The folds of anemones are "HIJKLMNOPQ", Hermit crab yes "ZYXWVUT". such , They can be completely mismatched . Here are two strings for you S1、S2, Respectively represents the shell of anemone and hermit crab , For them to live happily in the future , Please help calculate whether they match .
Input
The input includes multiple sets of test data . Each set of test data includes two strings H、J, Respectively represents the shell of anemone and the shell of hermit crab . It can ensure that their length is less than 100000. Enter to 0 0 end .
Output
If the shells of hermit crab and anemone can match , It outputs "Yes", Otherwise output "No".
sample input 1
ABCDEFG ZYXWVUT
AHBICJDKELFMGN ZYXWVUT
ABCD ZYXWVUT
HIJKLMNOPQ ZYXWVUT
0 0
sample output 1
Yes
Yes
No
No
#include<string.h>
#include<stdio.h>
char h[100010],j[100010];
int main(){
while(scanf("%s %s",h,j)){
if(strcmp(h,"0")==0 && strcmp(j,"0")==0) break;
int i,k=0;
for(i=0;i<strlen(h);++i){
if(h[i]-'A'+j[k]-'A'==25)
k++;
}
if(k>=strlen(j))
printf("Yes\n");
else
printf("No\n");
}
}
边栏推荐
- Loadng class `com. mysql. jdbc. Driver‘. This is deprecated. The new driver class is `com. mysql. cj. jdb
- linxu下调试微信调一跳(Fedora 27)
- [jmeter] TCP Sampler
- X11 forwarding
- University
- 什么是数据中台?
- Homework
- Common user password encryption methods and cracking methods
- 天翼云 杭州 云主机(VPS) 性能评测
- Machine learning - classification prediction of logistic regression
猜你喜欢

Full experience of soft examination at the beginning, middle and advanced levels

TCP/IP协议学习

Share the application cases of CS brand patch T card in the field of hunting camera

关于STM汇编程序设计相关学习

STM32 serial communication related learning

postgresql 数据库如何设置主键自增长

高并发day02(Concurrent包)

使用Altium Designer软件绘制一个基于stm32设计

Talk about Zhongtai: my understanding and thinking about Zhongtai

基于I2C的温度采集实验及实验心得
随机推荐
Wu Enda machine learning chapter 10-11
Comparison of advantages and disadvantages between SD NAND and EMMC
上课啦要点名啊
解决sonar的单元测试的覆盖率会为0问题
F5ltm (I) logic diagram
Gentoo安装教程(Systemd+Gnome)
telnet安装
Manual string comparison (pointer question)
汉诺塔2(函数)
postgresql 数据库如何设置主键自增长
Talk about Zhongtai: my understanding and thinking about Zhongtai
[automated testing] - robotframework practice (I) building environment
X11 forwarding
文本三剑客之sed命令--文本替换;grep命令---文本过滤
notepad++下划线以及大小写字母置换
渊子赛马。
C 语言结构体数组指针以及函数
Get the first and last values after Oracle grouping and sorting
小迪网络安全笔记-信息收集-架构、搭建、waf(8)
Tcp/ip protocol learning