C++ | Simple Approach
\n# Complexity\n- Time complexity: O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int furthestDistanceFromOrigin(string moves) {\n        int cnt=0,cnt1=0;\n        for(auto it: moves){\n            if(it==\'L\'){cnt--; cnt1--;}\n            else if(it==\'_\'){cnt--; cnt1++;}\n            else if(it==\'R\'){cnt++; cnt1++ ;}\n        }\n        return max(abs(cnt1),abs(cnt));\n    }\n};\n```
['C++']