酷代码 AI
菜单
服务商

判断键盘粘连输入:原始字符串与键入字符串的匹配验证

```cpp #include <iostream> #include <cstdlib> #include <string> using namespace std; bool isLongPressedStr(string origin, string typed) { int i = 0, j = 0; while (j < typed.length()) { if (i < origin.length() && origin[i] == typed[j]) { i++; j++; } else if (j > 0 && typed[j] == typed[j - 1]) { j++; } else { return false; } } return i == origin.length(); } ``` ######[AI问答 | 139点数解答 | 2025-11-12 15:06:42]

相关提问
本站限时免费提问中
实用工具查看更多
Linux在线手册 [开发类]
Jquery在线手册 [开发类]
今日油价 [生活类]
图片互转base64 [开发类]
时间转换器 [开发类]