Your task is to produce string that contains average characters of string. First character of result would be average character of first character (which is first character) and second character average of two first characters and so on.
What is average character?
Strings are arrays of bytes. Average character of string can be found by calculating the average of the ASCII values of characters in string and taking corresponding ASCII character.
For example string
"Hello!" can be written as byte sequence
72 101 108 108 111 33. Average of ascii values is 533/6 = 88.833... and when it's rounded to nearest integer we get 89 which is ascii code for captial letter
- You can assume that input contains only printable ASCII characters
- Input can be read from stdin or as command line arguments or as function arguments
- Output must be stdout. If your program is function, you can also return the string you would otherwise print.
- It must be whole program or function, not snippet
- Standard loopholes apply
- Integers are rounded by function
floor(x+0.5)or similar function.
How do I win?
This is code-golf, so shortest answer (in bytes) in wins.