C++ Easy solution
\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s=to_string(num);\n        string t=s;\n        char c=s[0];\n        char d=s[
```\nclass Solution {\npublic:\n    int minMaxDifference(int num) {\n        string s=to_string(num);\n        string t=s;\n        char c=s[0];\n        char d=s[0];\n        int i=0;\n        while(true){\n            if(s[i]!=\'9\'){\n                 c=s[i];\n                break;\n            }\n            else{\n                i++;\n            }\n        }\n        replace(s.begin(),s.end(),c,\'9\');\n        replace(t.begin(),t.end(),d,\'0\');\n        return stoi(s)-stoi(t);\n    }\n};\n```
['C++']