Post History
Lua 5.4.4, 99 bytes _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end) Try it online! Thanks to @orthoplex for more shortening.
Answer
#2: Post edited
# [Lua 5.4.4](https://lua.org), 131 bytes- ```
_=0 for c in s:gmatch'.'do if _==256or _<0then _=0 end _=c=='i'and _+1or c=='d'and _-1or c=='s'and _^2or c=='o'and print(_)or _ end- ```
[Try it online!](https://tio.run/##hY/BDoIwEETv/Yq9LUQwSKIHY39FQijIRqWErSfjt2PXghAvTpp03u5kmt4e5ehqdqDhqcALiZjZYhLICBKb72Dif1ry0karMy@siMmSb/Ru6SdaexGzoV8tPaheSjV2gGsCDNRBX9LAkfwqBmNVP1DnIo7HQmcguUpCfLzcS1e1uEVjgRootM73B78uTplr6w4kXnfG35XWSFiK3@ykwLMJnM7Mgc/5xPbD4e0illopG8MA00kYK5m@AQ)----Another version, 131 bytes:```_=0 s:gsub('.',function(c)if _==256or _<0then _=0 end _=c=='i'and _+1or c=='d'and _-1or c=='s'and _^2or c=='o'and print(_)or _ end)```[Try it online!](https://tio.run/##hY/BCsIwDIbvfYrcsuIUHehB7Ks45rppUFpZupP47LOx0w0v/hSaLw1f6K2vhtBwAAMPBTFIxMwe80RWkNh@GyP/yzQvNpqdz4OXMHmKxlhNfqJ5LWG29JvJg@qpVOs7uObAQA7uFXWcya80WK/uHbmQsR5Kswben7k/ZbjCvO1dHci7rNbUQmlMsd1FS3lYh0vjQKYbZ@NdG4OEldSLTZwQtomXH@bEx2Jk/@a0utSiFZkeUgeXY1Cr2B5e)
- # [Lua 5.4.4](https://lua.org), 99 bytes
- ```
- _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end)
- ```
- [Try it online!](https://tio.run/##hY/BCsIwEETv@Yq9JdFUrKAHJV9SyqKNyqIkpdueSr@9JlatePERyMzuZCD37ji2Z27BQi8gIomYOUgzOZcssfsMXv4fcz610dd5L0KCKVBsjGruJ/rWCWZHv8w9UgxCXEIDNwMM5KE@UsMq/UqDC6JuyLeK9Yh2zfsrdyclV9JcOl@1FLyqNFrVO4tZbsjiMj@wxQUOuqjK2Do9Rx0lQkoWm@2utGtTZHm8YgzL5@7snR6ntMxeSC3ieHwA)
- Thanks to [@orthoplex](https://codegolf.codidact.com/users/56271) for more shortening.
#1: Initial revision
# [Lua 5.4.4](https://lua.org), 131 bytes ``` _=0 for c in s:gmatch'.'do if _==256or _<0then _=0 end _=c=='i'and _+1or c=='d'and _-1or c=='s'and _^2or c=='o'and print(_)or _ end ``` [Try it online!](https://tio.run/##hY/BDoIwEETv/Yq9LUQwSKIHY39FQijIRqWErSfjt2PXghAvTpp03u5kmt4e5ehqdqDhqcALiZjZYhLICBKb72Dif1ry0karMy@siMmSb/Ru6SdaexGzoV8tPaheSjV2gGsCDNRBX9LAkfwqBmNVP1DnIo7HQmcguUpCfLzcS1e1uEVjgRootM73B78uTplr6w4kXnfG35XWSFiK3@ykwLMJnM7Mgc/5xPbD4e0illopG8MA00kYK5m@AQ) ---- Another version, 131 bytes: ``` _=0 s:gsub('.',function(c)if _==256or _<0then _=0 end _=c=='i'and _+1or c=='d'and _-1or c=='s'and _^2or c=='o'and print(_)or _ end) ``` [Try it online!](https://tio.run/##hY/BCsIwDIbvfYrcsuIUHehB7Ks45rppUFpZupP47LOx0w0v/hSaLw1f6K2vhtBwAAMPBTFIxMwe80RWkNh@GyP/yzQvNpqdz4OXMHmKxlhNfqJ5LWG29JvJg@qpVOs7uObAQA7uFXWcya80WK/uHbmQsR5Kswben7k/ZbjCvO1dHci7rNbUQmlMsd1FS3lYh0vjQKYbZ@NdG4OEldSLTZwQtomXH@bEx2Jk/@a0utSiFZkeUgeXY1Cr2B5e)