Question: Goldman Sachs , Recent Online Assessment Questions | ASCII Encoded Strings | 2023
1
Entering edit mode

ADD COMMENTlink 16 months ago PoGo 2.4k
0
Entering edit mode

string decode(string p) {
    // Write your code here.
    int n=0;
    string ans;
        for (int i = p.length() - 1; i >= 0; --i) {
        char a = p[i];
        int myInt = a - '0';
        n = n * 10 + myInt;

        if ((n >= 65 && n <= 90) || (n >= 97 && n <= 122) || n == 32) {
            ans =ans+ static_cast<char>(n);
            n = 0;
        }
    }

    return ans;
    
}

ADD COMMENTlink 14 months ago Jyoti Chaurasia • 0

Login before adding your answer.

Similar Posts
Loading Similar Posts