网站开发目前主要用什么技术,wordpress 文章摘要 插件,wordpress评论已关闭,化妆品网站源码asp我们老师的话说就是#xff0c;你学长睡了四年的床板子你不收拾收拾就往上躺着睡觉吗#xff1f;#xff1f;#xff1f;一定要记得用到计数变量时首先要赋初值0或者其他#xff0c;按题目要求来。
用
输入样例 1#xff1a;
Hello!
are you there?
wantta chi1 huo3…我们老师的话说就是你学长睡了四年的床板子你不收拾收拾就往上躺着睡觉吗一定要记得用到计数变量时首先要赋初值0或者其他按题目要求来。
用
输入样例 1
Hello!
are you there?
wantta chi1 huo3 guo1?
thats so li hai le
our story begins from chi1 huo3 guo1 le
.
输出样例 1
5
3 2输入样例 2
Hello!
are you there?
wantta qi huo3 guo1 chi1huo3guo1?
thats so li hai le
our story begins from ci1 huo4 guo2 le
.
输出样例 2
5
-_-#
用到的知识在链接里字符串知识1
用到函数strstrstrncmp char t[] chi1 huo3 guo1; char s[85]; int tt 0;//记录发了几条 int st-1;//记录第一次出现的位置 int cnt 0;//记录出现了多少次 if(strlen(s) 14)//因为要对比的长度只有14必需要比14长才有可能包含 { for(int i 0; i strlen(s) - 14; i ){ //以输入的语句为基准从下标0开始寻找 if(0 strncmp(s[i],t[0],14))//意思是从si和t0开始向后比较14个字符若全部相同则返回0 { if(st -1){ st tt; } cnt; break; } } } } 代码
#includestdio.h
#includestring.h
#includemath.hint main()
{char t[] chi1 huo3 guo1;char s[85];int tt 0;//记录发了几条int st-1;//记录第一次出现的位置int cnt 0;//记录出现了多少次while(1){gets(s);//输入的语句中有空格要用gets// printf($$$%s\n,s);if(s[0] . strlen(s) 1)//如果只有一个符号 . ,跳出whilebreak;tt ;if(strlen(s) 14)//因为要对比的长度只有14必需要比14长才有可能包含{for(int i 0; i strlen(s) - 14; i ){//以输入的语句为基准从下标0开始寻找if(0 strncmp(s[i],t[0],14))//意思是从si和t0开始向后比较14个字符若全部相同则返回0{if(st -1){st tt;}cnt;break;}}}}printf(%d\n,tt);if(st -1)//如果没更新过st也就是没有出现字符串chi1 huo3 guo1{printf(-_-#);}else{printf(%d %d,st,cnt);}return 0;
}结果