当前位置:网站首页>[calculate the number of times that one string is equal to another string]
[calculate the number of times that one string is equal to another string]
2022-07-26 00:32:00 【Li is struggling】
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
int m = 0;
string s1;
cout <<" Please enter the contents of the first string :" << endl;
cin >> s1;
cout << " Please enter the content of the second string :" << endl;
string s2;
cin >> s2;
if (s1.length() < s2.length())
{
cout << " No one is equal !" << 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 << " Yes " << m << " individual " << endl;
}
return 0;
}

边栏推荐
猜你喜欢

C语言 预处理详解

Pikachu target clearance and source code analysis

Verilog语法基础HDL Bits训练 05

基于网络分析和文本挖掘的意见领袖影响力研究

DC-6--vulnhub靶场

12.神经网络模型

HNOI2012矿场搭建

寻找命令find和locate

白蛋白纳米粒表面修饰低分子量鱼精蛋白LMWP/PEG-1900修饰牛血清白蛋白制备研究

After seven years of testing, the interview with Huawei finally negotiated a salary of 10000. HR said that I didn't respect Huawei and they didn't have such a low salary position~
随机推荐
In order to grasp the redis data structure, I drew 40 pictures (full version)
Hefei approved in advance
基于网络分析和文本挖掘的意见领袖影响力研究
Applet page generation link sent by SMS
Instructions for pinduoduo's API to get the list of goods according to keywords
What is software testing peer review?
JVM 三色标记法与读写屏障
【计算一个字符串和另一个字符串相等的次数】
Solve page refresh without attaching data
[directory] nodejs, NPM, yarn, bug
GOM和GEE引擎黑屏不显示界面,装备地图怪物的解决方法
[GOM引擎]假人配置的脚本设置方法
FreeRTOS personal notes - message queue
分布式事务 :可靠消息最终一致性方案
JVM Tri Color marking and read-write barrier
Super super super realistic digital people! Keep you on the air 24 hours a day
Semaphore
[contents] mqtt, nodejs projects
2022/7/24 考试总结
Markdown writing platform