当前位置:网站首页>[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;
}

边栏推荐
- Multitask programming
- CountDownLatch
- [GOM引擎]假人配置的脚本设置方法
- Research on the integrated data quality management system and technical framework under the scenario of data circulation and transaction
- [英雄星球七月集训LeetCode解题日报] 第25日 树状数组
- [directory] nodejs, NPM, yarn, bug
- Nest.js 用了 Express 但也没完全用
- Pikachu靶机通关和源码分析
- LDP related knowledge
- What is Web3 game?
猜你喜欢

基于MFFMB的电商评论文本分类研究

Thymeleaf view integration

C语言 预处理详解

JVM Tri Color marking and read-write barrier

【计算一个字符串和另一个字符串相等的次数】

What is software testing peer review?

Research on text classification of e-commerce comments based on mffmb

Nest. JS uses express but not completely

数据流通交易场景下数据质量综合管理体系与技术框架研究

In order to grasp the redis data structure, I drew 40 pictures (full version)
随机推荐
HOOPS Exchange助力混合计算流体动力学软件搭建3D格式导入读取功能 | 客户案例
一个List到底能存多大的数据呢?
This time, thoroughly understand promise principle
The way to understand JS: the principle of object.call and object.create() inheritance
CyclicBarrier
Linked list related methods
Matlab makes the image of serial port output data in real time
本地电脑架设传奇怎么开外网叫朋友一起玩?
快速入门顺序表链表
[GOM引擎]假人配置的脚本设置方法
Verilog语法基础HDL Bits训练 05
找出单身狗(力扣260)
Revision of Journal of Computational Physics
What is software testing peer review?
mysql事务的引入
[contents] mqtt, nodejs projects
The way of understanding JS: write a perfect combination inheritance (Es5)
Research on text classification of e-commerce comments based on mffmb
Hefei approved in advance
2022/7/25 考试总结