国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

LeetCode 58. Length of Last Word

2019-11-08 02:02:28
字體:
來源:轉載
供稿:網友

Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last Word in the string.

If the last word does not exist, return 0.

Note: A word is defined as a character sequence consists of non-space characters only.

For example, Given s = "Hello World",return 5.

程序代碼:

int lengthOfLastWord(char* s) { int count = 0; int i=strlen(s)-1; while(s[i]==' ') i--; while(s[i]!=' '&&i>=0) { count++; i--; } return count;}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 天镇县| 定边县| 华蓥市| 阿鲁科尔沁旗| 清水河县| 安溪县| 余姚市| 柯坪县| 屯门区| 赤水市| 黄浦区| 阿鲁科尔沁旗| 会昌县| 赞皇县| 五寨县| 泾阳县| 邵武市| 花莲县| 鄂托克旗| 白山市| 雅安市| 磐石市| 永吉县| 株洲市| 江城| 伊通| 潜江市| 华池县| 城口县| 界首市| 余江县| 中西区| 平泉县| 浦县| 海兴县| 洛阳市| 临夏市| 白水县| 区。| 策勒县| 徐闻县|