[Java/C++/Python] Easy Count
Explanation\nWe check L and R,\nand see how far it\'s from the origin.\nThen all _ just go further.\n\n\n# Complexity\nTime O(n)\nSpace O(1)\n\n\nJava\njava\n  
# **Explanation**\nWe check `L` and `R`,\nand see how far it\'s from the origin.\nThen all `_` just go further.\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(1)`\n<br>\n\n**Java**\n```java\n    public int furthestDistanceFromOrigin(String moves) {\n        int res = 0, d = 0;\n        for (int i = 0; i < moves.length(); ++i) {\n            if (moves.charAt(i) == \'L\') res--;\n            if (moves.charAt(i) == \'R\') res++;\n            if (moves.charAt(i) == \'_\') d++;\n        }\n        return Math.abs(res) + d;\n    }\n```\n\n**C++**\n```cpp\n    int furthestDistanceFromOrigin(string moves) {\n        int res = 0, d = 0;\n        for (auto c : moves) {\n            if (c == \'L\') res--;\n            if (c == \'R\') res++;\n            if (c == \'_\') d++;\n        }\n        return abs(res) + d;\n    }\n```\n\n**Python**\n```py\n    def furthestDistanceFromOrigin(self, s: str) -> int:\n        return abs(s.count(\'R\') - s.count(\'L\')) + s.count(\'_\')\n```\n
['C', 'Python', 'Java']