Easy to Understand || Beats 100% in C++ & Python || C++, Java, Python
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Screenshot\n![image.png](https://assets.leetcode.com/users/images/5699cde6-609f-469d-a6d1-c8f0cc564205_1733918640.1441736.png)\n\n![image.png](https://assets.leetcode.com/users/images/e0147701-f614-492c-8ba7-a7d3c5f8ed42_1733918745.9299948.png)\n\n\n<!-- Describe your approach to solving the problem. -->\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```cpp []\nclass Solution {\npublic:\n    bool isBalanced(string num) {\n        int even = 0;\n        int odd = 0;\n\n        for (int i = 0; i < num.length(); i++) {\n            int s = num[i] - \'0\';\n            if (i % 2 == 0) {\n                odd += s;\n            } else {\n                even += s;\n            }\n        }\n\n        return (even == odd);\n    }\n};\n\n\n```\n```java []\nclass Solution {\n    public boolean isBalanced(String num) {\n        int even = 0;\n        int odd = 0;\n\n        for (int i = 0; i < num.length(); i++) {\n            int s = Integer.parseInt(String.valueOf(num.charAt(i)));\n            if (i % 2 == 0) {\n                odd = odd + s;\n            } else {\n                even = even + s;\n            }\n        }\n        return (even == odd);\n    }\n}\n\n\n```\n```python3 []\nclass Solution:\n    def isBalanced(self, num: str) -> bool:\n        even = 0\n        odd = 0\n\n        for i in range(len(num)):\n            if i%2 == 0:\n                odd += int(num[i])\n            else:\n                even += int(num[i])\n        \n        return odd == even\n\n\n```
['String', 'Python', 'C++', 'Java', 'Python3']