C++ simple iteration
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string mas = to_string(num), mis = mas;\n        char dig1 = \' \', dig2 = \' \';\n        for(int i = 0; i < mas.length(); ++i){\n            if(mas[i] == dig1)  mas[i] = \'9\';\n            else if(mas[i] != \'9\' && dig1 == \' \'){\n                dig1 = mas[i];\n                mas[i] = \'9\';\n            }\n            if(mis[i] == dig2)  mis[i] = \'0\';\n            else if(mis[i] != \'0\' && dig2 == \' \'){\n                dig2 = mis[i];\n                mis[i] = \'0\';\n            }\n        }\n        return stoi(mas) - stoi(mis);\n    }\n};\n```
['C++']