lengthOfLastWord
来源:互联网 发布:网络什么最赚钱的方法 编辑:程序博客网 时间:2024/06/01 07:53
输出字符串中最后一个单词的长度
if not s: print(0)else: i = 1 n = 0 while i <= len(s) and s[-i] == ' ': i = i + 1 while i <= len(s) and not (s[-i] ==' '): i = i + 1 n = n + 1print(n)
阅读全文
0 0
- lengthOfLastWord
- LeetCode(57)LengthOfLastWord
- NFC (二)读写MifareClassic协议的NFC卡
- poj1502spfa(模板)
- 【Linux】vi编辑器
- 别混淆数据争用(data race) 和竞态条件(race condition)
- 阿里云Centos7使用yum安装MySQL5.6的正确姿势
- lengthOfLastWord
- How Many Tables HDU
- thinkphp中的钩子_什么是钩子?
- Java
- iOS 代理修饰词weak 不用assgin
- python decorator的理解
- 嫉妒心里的分析
- mac terminal setup
- jQuery中事件命名空间