+ 2
Long String Challenge [answer with a code] (04)
Given a string compute the sum of all digits from left to right. If you find the character 'x' remove it and jump back two chars, until you reach the end of the string. For example, if the string was: 123x456 the answer would be 26. what is the answer for string: 93752xxx746x27x1754xx90x93xxxxx238x44x75xx08750912738x8461x8759383xx328x4x4935903x6x5550360535004x0xx945958961296x267x8842xxx5x6xx61x4x48482x80xxx83316843x7x4x83x9521731xxx25x51xx457x6x5x9698222x771237745034x5133592x27xx8x87xx35221x36x0x50
8 Respostas
+ 25
Is the answer 1385?
https://code.sololearn.com/cqG4I475a7d0/#cs
+ 23
@jay I read it as 11
+ 6
So just for clarification the answer to 11111xx11 is 7 or 11
i.e 5 then x, another x, 5 + 1 + 1.
Total: 7
or does it go
5 then x, 5 + 1 + 1 then x, 7 + 1 + 1 + 1 + 1
total: 11
+ 6
Is this right?
https://code.sololearn.com/cI91N6LotnWU/#cpp
+ 5
oooo ok. well that is a bit trickier. Have to keep a copy of the string
+ 3
+ 3
https://code.sololearn.com/csvbo39CzhOh/#cs
+ 2
Yes. the answer would be 11.