C++| Easy to Understand | 0ms Runtime | Small Code |100% faster | O(n) approach
DO Like my solution , if you Find my Post Helpfull !!!\n\nclass Solution {\npublic:\n    int minimumMoves(string s) {\n        int count=0;// answer will be sto
DO Like my solution , if you Find my Post Helpfull !!!\n```\nclass Solution {\npublic:\n    int minimumMoves(string s) {\n        int count=0;// answer will be stored in this variable\n        for(int i=0;i<s.length();i++){\n            if(s[i]==\'X\'){// if substring of size 3 starts with \'X\' -->++count and increment by 2\n                ++count;\n                i+=2;\n            }\n        }\n        return count;\n        \n    }\n};\n```\n![image](https://assets.leetcode.com/users/images/6cc29593-c8b9-4071-9ecc-48e00b6fe425_1633264209.494313.png)\n\n
['Greedy', 'C']