当前位置:网站首页>Force deduction ----- the number of words in the string
Force deduction ----- the number of words in the string
2022-07-26 13:35:00 【qq_ thirty-seven million seven hundred and sixty thousand seven】

int countSegments(char * s){
int len=strlen(s);
int count=0;
int flag=0;
for(int a=0;a<len;a++){
if(s[a]!=' '){
flag++;
}
else{
if(flag>0){
count++;
}
flag=0;
}
}
if(count==0&&flag==0){
return count;
}
if(s[len-1]==' '){
return count;
}
return count+1;
}
边栏推荐
- This article explains the FS file module and path module in nodejs in detail
- A college archives management system based on asp.net
- Square root of leetcode 69. x
- JUC总结
- Analysis on the current situation and optimization strategy of customer experience management in banking industry
- 7-25 0-1 backpack (50 points)
- Official announcement! Edweisen group and Baidu xirang reached a deep co creation cooperation
- B+ tree (4) joint index -- MySQL from entry to proficiency (16)
- Huawei computer test ~ offset realizes string encryption
- 算法--连续数列(Kotlin)
猜你喜欢

【OAuth2】八、OAuth2登录的配置逻辑-OAuth2LoginConfigurer和OAuth2ClientConfigurer

File upload and download performance test based on the locust framework

Analysis on the current situation and optimization strategy of customer experience management in banking industry

Basic sentence structure of English ----- origin

Photoshop(CC2020)未完

Unity中序列化类为json格式

估值15亿美元的独角兽被爆裁员,又一赛道遇冷?

How to face scientific and technological unemployment?

Unicorn, valued at $1.5 billion, was suddenly laid off, and another track was cold?

One stroke problem (Chinese postman problem)
随机推荐
See you tomorrow at the industrial session of cloud intelligence technology forum!
官宣!艾德韦宣集团与百度希壤达成深度共创合作
7-25 0-1 backpack (50 points)
[oauth2] v. oauth2loginauthenticationfilter
【开源之美】nanomsg(2) :req/rep 模式
B+ tree index use (8) sorting use and precautions (20)
Extra (5) - MySQL execution plan (51)
Concept and handling of exceptions
MySQL data directory (1) -- database structure (24)
[upper computer tutorial] Application of integrated stepping motor and Delta PLC (as228t) under CANopen communication
vector的一些实用操作
终极套娃 2.0 | 云原生交付的封装
Codeforces Round #810 (Div. 2)【比赛记录】
Leetcode 263. ugly number
飞盘,2022年“黑红”顶流
Photoshop (cc2020) unfinished
Leetcode 217. there are duplicate elements
Algorithm -- continuous sequence (kotlin)
LCL三相pwm整流器(逆变器)
Precautions for triggering pytest.main() from other files