Long Pressed Name LeetCode solution in C++
1class Solution {2public:3bool isLongPressedName(string name, string typed) {4int j = 0, i = 0;5for (; i < name.length() && j < typed.length(); i++) {6if (name[i] != typed[j++]) return false;78if (i < name.length() && name[i] != name[i + 1]) {9while (j < typed.length() && typed[j] == name[i]) j++;10}11}1213return (i == name.length() && j == typed.length());14}15};