C++ | Getting Runtime Error | Same Code working in VS
Can anyone help me - why i\'m getting runtime error in this one\nLine no -  if i\'m commenting from \nint m = up.length() to st.pop();\nMy code is running on LC
Can anyone help me - why i\'m getting runtime error in this one\nLine no -  if i\'m commenting from \nint m = up.length() to st.pop();\nMy code is running on LC... and without commenting that part i\'m getting correct ouput in VS.\nAny suggestions ?\n\n```\nstring abbreviateProduct(int left, int right) {\n        long long int prod = 1;\n        for(int i =left; i<=right;i++)\n        {\n            prod = prod*i;\n        }\n        \n        string word = std::to_string(prod);\n        \n        int n = word.length();\n        string prefix = word.substr(0,5);\n        int zero =0, k;\n        for(int i = n-1;i>=0;i--)\n        {\n            if(word[i] == \'0\')\n                zero++;\n            else\n            {\n                k = i;\n                break;\n            }\n        }\n        \n        string up = word.substr(0, k+1);\n        \n        string suffix;\n\n        int m = up.length();\n        queue<char> st;\n        for(int i = m-5;i<m;i++)\n        {\n            st.push(up[i]);\n        }\n        while(!st.empty())\n        {\n            suffix+=st.front();\n            st.pop();\n        }\n\n        up = up + "e" + std::to_string(zero);\n\n        if (up.length() > 10)\n        {\n            up.clear();\n            up+=prefix;\n            up.push_back(\'.\');\n            up.push_back(\'.\');\n            up.push_back(\'.\');\n            up+=suffix;\n            up = up + "e" + std::to_string(zero);\n        }\n        return up;\n    }\n```
['C']