[Python] Greedy Sliding Window
Think about it:\n\n "XOX" is a good deal, because we can convert two X\'s\n "XXX" is also an obvious good deal\n "XXO" is a good deal too\n\nA few bad deals:\n 
Think about it:\n\n* "XOX" is a good deal, because we can convert two X\'s\n* "XXX" is also an obvious good deal\n* "XXO" is a good deal too\n\nA few bad deals:\n* "OXX"\n\t* This could easily become "XXX" if we slide the window along by one\n\t* Thus, we should only convert "XXO" because we know the next will either be\n\t\t* "XOO" or "XOX"\n* "OOX"\n\t* Obviously, this could slide and become "XXX" or "XXO" or "XOX"\n\nThus, you just need to analyze each case for the sliding window, and decide if we want to perform the operation or not.\n\n```python\ndef minimumMoves(s):\n\n\ts += "OOO"\n\n\ti, result = 0, 0\n\n\twhile i < len(s)-3:\n\t\twindow = s[i:i+3]\n\t\tif window in ["XOX", "XXX", "XOO", "XXO"]:\n\t\t\ti += 3\n\t\t\tresult += 1\n\t\telse:\n\t\t\ti += 1\n\n\treturn result\n```
['Python', 'Python3']