字符串练习18_验证子串
来源:互联网 发布:管家婆软件怎么样 编辑:程序博客网 时间:2024/06/06 03:34
/*Name: 18_验证子串Copyright: Author: Date: 01-09-17 22:06Description: 18_验证子串查看 提交 统计 提问总时间限制: 1000ms 内存限制: 65536kB描述输入两个字符串,验证其中一个串是否为另一个串的子串。输入输入两个字符串,每个字符串占一行,长度不超过200且不含空格。输出若第一个串s1是第二个串s2的子串,则输出(s1) is substring of (s2) 否则,若第二个串s2是第一个串s1的子串,输出(s2) is substring of (s1) 否则,输出 No substring。样例输入abcdddncabca样例输出abc is substring of dddncabca*/#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N = 201;char S1[N],S2[N];int main() {gets(S1); gets(S2);if (strlen(S1) >= strlen(S2)){if (strstr(S1, S2) != NULL)cout << S2 << " is substring of " << S1 << endl;elsecout << "No substring" << endl;}else{if (strstr(S2, S1) != NULL)cout << S1 << " is substring of " << S2 << endl;elsecout << "No substring" << endl;}return 0;}
阅读全文
0 0
- 字符串练习18_验证子串
- 编程练习,寻找字符串中的子串
- 18:验证子串
- 【编程小练习】删除字符串中的子串
- java练习获取两个字符串的最大相同子串
- 字符串练习17_字符串判等
- 01_求给定字符串最长重复子串
- 20150605字符串及内存管理_练习
- 字符串练习06_合法C标识符
- 字符串练习04_石头剪子布
- 字符串练习11_潜伏者
- 字符串练习14_大小写字母互换
- 字符串练习21_单词替换
- 字符串练习22_紧急措施
- 数组和字符串_课后练习
- lwj_C#_周总结2 字符串练习
- 设计一个字符串子串删除函数 将结果子串指针返回 用主程序验证
- 黑马程序员_日记23_字符串反转练习
- C#+VS2012图片二进制流与数据库MySql、水晶报表间的操作(二)
- 小屏幕控制 (类似lol小地图)
- 字符串练习17_字符串判等
- 3、IP网际协议
- HDU-3068 最长回文串
- 字符串练习18_验证子串
- css清除浮动float总结
- python --- 处理很长的判断语句,多重赋值,联合删除
- Oracle用户和权限
- 二步实现 远程连接 阿里云SqlServer 2012 数据库服务器
- C语言实现的ABCI
- CodeForces
- Struts2-数据验证
- 51Nod 1012 最小公倍数LCM