C++ & Java Solution
Approach\n1. Count \'L\' \'R\' & \'\'.\n2. We need to convert the \'\' to the one of \'L\' or \'R\' whose count is larger.\n3. Then we decrement the total count
# Approach\n1. Count \'L\' \'R\' & \'_\'.\n2. We need to convert the \'_\' to the one of \'L\' or \'R\' whose count is larger.\n3. Then we decrement the total count by min of \'L\' & \'R\' count\n3. So the final answer will be = \n   max of( count(R), count(L) ) + count(\'_\') - min of(count(R), count(L))\n\n\n# C++\n```\nint furthestDistanceFromOrigin(string moves) {\n    unordered_map<char, int> count;\n    for(auto c: moves) count[c]++;\n    return max(count[\'L\'],count[\'R\']) - min(count[\'L\'], count[\'R\']) + count[\'_\'];\n}\n```\n\n# Java\n```\nint furthestDistanceFromOrigin(String moves) {\n    HashMap<Character, Integer> count = new HashMap<>();\n    for (char c : moves.toCharArray()) {\n        count.put(c, count.getOrDefault(c, 0) + 1);\n    }\n    return Math.abs(count.getOrDefault(\'L\', 0) - count.getOrDefault(\'R\', 0))\n            + Math.abs(count.getOrDefault(\'_\', 0));\n}\n```\n\n\n---\n\n<b>Here is an article of my last interview experience - A Journey to FAANG Company, I recomand you to go through this to know which all resources I have used & how I cracked interview at Amazon:\nhttps://leetcode.com/discuss/interview-experience/3171859/Journey-to-a-FAANG-Company-Amazon-or-SDE2-(L5)-or-Bangalore-or-Oct-2022-Accepted\n\n---
['C++', 'Java']