当前位置:网站首页>1163: affinity string (string)
1163: affinity string (string)
2022-04-21 09:10:00 【Qian Qian】
1163: Affinity string ( character string )
Title Description
Judge affinity string . The definition of affinity string is like this : Given two strings s1 and s2, If you can pass s1 Cyclic shift , send s2 Included in s1 in , So let's say s2 yes s1 Affinity string of .
Input
There are many sets of test data , The first line of each set of data contains the input string s1, The second line contains the input string s2,s1 And s2 The length of each of them is less than 100000.
Output
If s2 yes s1 Affinity string of , The output "yes", conversely , Output "no". The output of each test takes up one line .
The sample input Copy
AABCD
CDAA
ASD
ASDF
ab
aba
Sample output Copy
yes
no
no
source / classification
#include<stdio.h>
#include<string.h>
#define N 200000
/* Judge affinity string s1 Cyclic shift s2 Included in s1 in Just put the s1 Change to two consecutive s1, Then judge directly strstr(str1,str2) Function is used to determine the string str2 Whether it is str1 The string of . If it is , Then the function returns str2 stay str1 The address that first appeared in ; otherwise , return NULL. */
int main(){
char s1[N],s2[N],s3[N];
while(scanf("%s%s",&s1,&s2)!=EOF){
if(strlen(s1)<strlen(s2)){
printf("no\n");
}
else{
strcpy(s3,s1);// take s1 The contents of are saved in s3
strcat(s1,s3);// take s3 The content of is followed by s1 Behind
if(strstr(s1,s2)!=NULL){
printf("yes\n");// Judgment string s2 Whether it is s1 The string of
}
else {
printf("no\n");
}
}
}
return 0;
}
版权声明
本文为[Qian Qian]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210906131910.html
边栏推荐
- Template adaptation guide for toudabi thesis
- 头大毕设论文模板适配指南
- uniapp 热更新和整包更新
- 1146: 吃糖果
- 1148: 组合三位数之一
- 编程如何提高自己的水平能力?学编程最重要的是什么?请看凡人浅谈如何学C
- 1151: 大整数加法
- [appium] use the simulator to realize the business functions of Youdao cloud app - add, search, modify and delete
- Simulation implementation vector
- 2022化工自动化控制仪表考试练习题及模拟考试
猜你喜欢
![Buuctf [actf2020 freshman competition] include](/img/20/3c0d0286c869385ee0c9a119e337e2.png)
Buuctf [actf2020 freshman competition] include

PageRank case Airport

目标检测入门常见问题(深度学习 / 图像分类)
![BUUCTF[HCTF 2018]WarmUp](/img/89/5d7d147dfb8e2bc10a2ff0bb68debe.png)
BUUCTF[HCTF 2018]WarmUp

Pipy MQTT 代理之(三)Logging

Maya basic tutorial and basic operation explanation

方格分割【dfs】

CC00043.CloudJenkins—————————————

L2-031 深入虎穴 (25 分)

2022 mobile crane driver examination exercises simulated examination platform operation
随机推荐
Penetration practice - dig a school site vulnerability (APP vulnerability)
My blog navigation directory (constantly sorting and updating...)
1148: 组合三位数之一
CC00043. CloudJenkins—————————————
Detailed explanation of kotlin cooperation process lanch
【ACM】131. 分割回文串
编程如何提高自己的水平能力?学编程最重要的是什么?请看凡人浅谈如何学C
网易博客居然要关了,我写的文章啊!
Notes of the most complete grain mall in the whole network_ 02. Introduction to the overall effect of the project (2022-04-02)
基于Ansible实现Apache Doris快速部署运维指南
PageRank case Airport
SurfaceView高性能绘制(五)代码实践篇-让绘制的图片运动
[CTF. Show. Reverse] moon cake cup RE1_ Northwest Wangxiang, re2_ Homing, RE3_ If there is no month
Pipy MQTT 代理之(三)Logging
1165: 实数的小数部分(指针专题)
Simulated 100 questions and simulated examination of Shanghai safety officer C certificate examination in 2022
BUUCTF[极客大挑战 2019]EasySQL
2022年T电梯修理考题及在线模拟考试
PC微信机器人个人号接口api之实战分析微信同意好友call
Drafting and Revision: Laplacian Pyramid Network for Fast High-Quality Artistic Style Transfer--T Li