Home > database >  Pb how to implement the string each 1?
Pb how to implement the string each 1?

Time:01-26

How to implement to transform a string? Judge string if is even, then + 1, and if it is odd, then + 2
Such as I get a string is abc1 then after transformation to become cce2
Could you tell me how to implement should be under?

CodePudding user response:

Do a array mapping, such as [a-z], [0-9] corresponding out two maps [odd], [even], and then according to the odd and even find the array subscript, go directly to the corresponding mapping to the array

CodePudding user response:

Converted to ASCII, cycle of judgment, and then computing
Intuitive way
  • Related