☑️ Swift Solution | Easy to understand
Since the substitution will not be used later, it can be omitted and only the occurrences can be counted.\nMy best result\nRuntime:\xA02 ms, faster than 100.00%
Since the substitution will not be used later, it can be omitted and only the occurrences can be counted.\nMy best result\nRuntime:\xA0**2 ms**, faster than **100.00%** of Swift online submissions for Minimum Moves to Convert String.\n```\nclass Solution {\n\tfunc minimumMoves(_ s: String) -> Int {\n\t\tvar arr = Array(s)\n\t\tvar index = 0\n\t\tvar result = 0\n\n\t\twhile index < arr.count {\n\t\t\tif arr[index] == "O" {\n\t\t\t\tindex += 1\n\t\t\t} else {\n\t\t\t\tindex += 3\n\t\t\t\tresult += 1\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n}\n```
['Swift']