• Custom User Avatar

    Char '0' is the starting of character numbers which go up by one till '9', so when 0 is subtracted the remainder is the integer itself.
    ASCII of '0' = 48
    ASCII of '3' = 51
    '3' - '0' => 51-48 = 3

  • Custom User Avatar

    Maybe. But my C++ solution still works, so I still think there's mistake in your code.

  • Custom User Avatar

    Maybe. But, it is occurring when I make an attempt to return the string. A string is modified after erase all '#' wtih std::string::erase. Also, I can output the modified string to the console.

  • Custom User Avatar

    When you read the error message you see that it's a stack overflow error so probably your solution causes too deep (infinite?) recursion, or creates a very large stack variable.

  • Custom User Avatar

    I got it, what should i do? (C++)

    UndefinedBehaviorSanitizer:DEADLYSIGNAL
    ==1==ERROR: UndefinedBehaviorSanitizer: stack-overflow on address 0x7fffbca4a000 (pc 0x000000425520 bp 0x7fffbca490e8 sp 0x7fffbca48bf0 T1)
    ==1==WARNING: invalid path to external symbolizer!
    ==1==WARNING: Failed to use and restart external symbolizer!
    #0 0x42551f (/workspace/test+0x42551f)
    #1 0x428149 (/workspace/test+0x428149)
    #2 0x4269ce (/workspace/test+0x4269ce)
    #3 0x426523 (/workspace/test+0x426523)
    #4 0x4260fb (/workspace/test+0x4260fb)
    #5 0x42ab15 (/workspace/test+0x42ab15)
    #6 0x42577d (/workspace/test+0x42577d)
    #7 0x7fe13021abf6 (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #8 0x404569 (/workspace/test+0x404569)

    ==1==ABORTING