当前位置:网站首页>【计算一个字符串和另一个字符串相等的次数】
【计算一个字符串和另一个字符串相等的次数】
2022-07-26 00:17:00 【李在奋斗……】
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int m = 0;
string s1;
cout <<"请输入第一个字符串的内容:" << endl;
cin >> s1;
cout << "请输入第二个字符串的内容:" << endl;
string s2;
cin >> s2;
if (s1.length() < s2.length())
{
cout << "没有一个是相等的!" << endl;
}
else
{
for (int i = 0; i < s1.length(); i++)
{
for (int j = 0; j < s2.length(); j++)
{
if (s1[i + j] != s2[j])
{
break;
}
else
{
if (j == s2.length()-1)
{
m++;
i += j;
i--;
}
}
}
}
cout << "有" << m << "个" << endl;
}
return 0;
}

边栏推荐
- MWEC:一种基于多语义词向量的中文新词发现方法
- Revision of Journal of Computational Physics
- 京东获取推荐商品列表 API
- IP Core: PLL
- IP核:PLL
- LCA 三种姿势(倍增,Tarjan+并查集,树链剖分)
- 基于MFFMB的电商评论文本分类研究
- Preparation of bovine serum albumin modified by low molecular weight protamine lmwp/peg-1900 on the surface of albumin nanoparticles
- nodejs启动mqtt服务报错SchemaError: Expected `schema` to be an object or boolean问题解决
- SSM environment integration
猜你喜欢

Private cloud disk setup

HOOPS Exchange助力混合计算流体动力学软件搭建3D格式导入读取功能 | 客户案例

Research progress of data traceability based on the perspective of data element circulation

NVIDIA programmable reasoning accelerator tensorrt learning notes (III) -- Accelerating reasoning

白蛋白纳米-超声微泡载组织型纤溶酶原激活物基因靶向制备研究

软件测试同行评审到底是什么?

基于SEIR模型的网络医疗众筹传播建模与仿真分析

测试7年,面试华为最后面议要薪1万,HR说我不尊重华为,他们没有那么低薪资的岗位~

JVM Tri Color marking and read-write barrier

FreeRTOS personal notes - mutex
随机推荐
Nodejs learning resources
Flask send verification code logic
2022/7/24 考试总结
TID-MOP:面向数据交易所场景下的安全管控综合框架
mysql事务的引入
CountDownLatch
Applet page generation link sent by SMS
MySQL - Multi version concurrency control (mvcc)
Bond network card mode configuration
MySQL - master-slave replication
Use of redis
Study on bovine serum protein modified phenolic acids and alkaloids small molecules / coupled microspheres protein / bovine erythrocyte SOD
PC website realizes wechat code scanning login function (II)
基于SEIR模型的网络医疗众筹传播建模与仿真分析
2022/7/19 考试总结
合肥提前批
如何让你的 JS 代码写得更漂亮
白蛋白纳米粒表面修饰低分子量鱼精蛋白LMWP/PEG-1900修饰牛血清白蛋白制备研究
Research progress of data traceability based on the perspective of data element circulation
[GOM引擎]假人配置的脚本设置方法