[Question]
  [
# Task
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 `Y`.
# Rules
* 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](http://meta.codegolf.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default) apply
* Integers are rounded by function `floor(x+0.5)` or similar function.
# How do I win?
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest answer (in bytes) in wins.
# Examples
* `Hello!` → `HW^adY`
* `test` → `tmop`
* `42` → `43`
* `StackExchange` → `Sdccd_ccccddd`
  
[Answer]
## Brainfuck 106 bytes
```
,[>,<.[->+<]>>++<[>[->+>+<<]>[-<<-[>]>>>[<[>>>-<<<[-]]>>]<<]>>>+<<[-<<+>>]<<<]>[-]>>>>[-<<<<<+>>>>>]<<<<<]
```
This is my first participation in a code-golf, please be gentle!
It does work but brainfuck can't handle floats (not that i know of) so the rounded value is always the bottom one (might fix my algorithm later).
Also, the algorithm averages the values 2 by 2, meaning it could be innacurate in some spots.
And I need to fix a bug that is printing a number at the end of the output too.
[Answer]
# Pyth, 16 bytes
```
smCs+.5csaYCdlYz
```
Pretty straightforward. Using `s+.5` instead of rounding, because for some reason `round(0.5, 0)` is 0 in Python.
[Answer]
# Q, ~~15~~ 12 bytes
12 bytes as an expression
```
"c"$avgs"i"$
q)"c"$avgs"i"$"Hello!"
"HW^adY"
q)"c"$avgs"i"$"test"
"tmop"
q)"c"$avgs"i"$"42"
"43"
q)"c"$avgs"i"$"StackExchange"
"Sdccd_ccccddd"
```
or 15 bytes as a function
```
{"c"$avgs"i"$x}
q){"c"$avgs"i"$x} "Hello!"
"HW^adY"
q){"c"$avgs"i"$x} "test"
"tmop"
q){"c"$avgs"i"$x} "42"
"43"
q){"c"$avgs"i"$x} "StackExchange"
"Sdccd_ccccddd"
```
takes advantage of 
1. the "i"$ cast to convert a string (list of characters) to a list of integers
2. the avgs function, which computes the running average of a list as a list of floats
3. the "c"$ cast to convert a list of floats to a list of characters, and which automatically rounds each float to the nearest integer before doing so [i.e. ("c"$99.5) = ("c"$100) and ("c"$99.4) = ("c"$99) ]
[Answer]
# CJam, 19 bytes
```
Uq{i+_U):Ud/moco}/;
```
Try it online in the [CJam interpreter](http://cjam.aditsu.net/#code=Uq%7Bi%2B_U)%3AUd%2Fmoco%7D%2F%3B&input=StackExchange).
[Answer]
# Perl: ~~31~~ 30 characters
(29 characters code + 1 character command line option.)
```
s!.!chr.5+($s+=ord$&)/++$c!ge
```
Sample run:
```
bash-4.3$ perl -pe 's!.!chr.5+($s+=ord$&)/++$c!ge' <<< 'StackExchange'
Sdccd_ccccddd
```
[Answer]
# [Python 3](https://docs.python.org/3/), 65 bytes
```
n=t=0
for c in input():n+=1;t+=ord(c);print(end=chr(int(.5+t/n)))
```
[Try it online!](https://tio.run/##K6gsycjPM/7/P8@2xNaAKy2/SCFZITMPiApKSzQ0rfK0bQ2tS7Rt84tSNJI1rQuKMvNKNFLzUmyTM4o0QGw9U@0S/TxNTc3//z1Sc3LyFQE "Python 3 – Try It Online")
If I use `round()` instead of `int(.5+` etc., it saves one character but is *technically* not in compliance with the challenge: Python's `round()` rounds halves to the nearest even integer, not upwards. However, it works correctly on all sample inputs.
[Answer]
# C# ~~189 135 134~~ 106 Bytes
```
var x=s.Select((t,i)=>Math.Round(s.Select(a=>(int)a).Take(i+1).Average())).Aggregate("",(m,c)=>m+(char)c);
```
Can be seen [here](http://csharppad.com/gist/f6195bf7201b38ea8f3c) 
First time golfer
[Answer]
# Ruby, 46
```
s=0.0
$<.bytes{|b|s+=b;$><<'%c'%(0.5+s/$.+=1)}
```
[ideone](https://ideone.com/FmKAjX).
With apologies to w0lf, my answer ended up different enough that it seemed worth posting.
`$<.bytes` iterates over each byte in stdin, so we print the rolling average in each loop. '%c' converts a float to a character by rounding down and taking the ASCII, so all we have to do is add 0.5 to make it round properly. `$.` is a magic variable that starts off initialized to 0--it's supposed to store the line count, but since here we want byte count we just increment it manually.
[Answer]
# JavaScript (ES6), 75 bytes
```
let f =
s=>s.replace(/./g,x=>String.fromCharCode((t+=x.charCodeAt())/++i+.5),i=t=0)
```
```
<input oninput="O.value=f(this.value)" value="Hello!"><br>
<input id=O value="HW^adY" disabled>
```
I can't believe there's no JS answer with this technique yet...
[Answer]
# [Python 2](https://docs.python.org/2/), 65 bytes
```
f=lambda s:s and f(s[:-1])+chr(int(sum(map(ord,s))*1./len(s)+.5))
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRodiqWCExL0UhTaM42krXMFZTOzmjSCMzr0SjuDRXIzexQCO/KEWnWFNTy1BPPyc1T6NYU1vPVFPzf0ERUBFQm7pHak5OvqK6poKygkd4XGJK5H8A "Python 2 – Try It Online")
[Answer]
# Ruby, 27 bytes
```
putc gets.sum.quo(~/$/)+0.5
```
Solution produced through some collaborative golfing at work.
## How this works
* `Kernel#putc` prints a single character (e.g. `putc "Hello"` outputs `H`). Passing an object to it prints the character whose code is the least-significant byte of the object. So `putc 72` outputs `H`.
* `Kernel#gets` reads stdin and returns a string.
* `String#sum` returns a checksum. The result is the sum of the binary value of each byte in the string modulo `2**16 - 1`. Since ASCII bytes comfortably fit in this space, this just returns the byte total.
* Because the byte total is an integer, we can’t do floating point calculations (in Ruby `10 / 3` is `3` whereas `10.to_f / 3` is `3.33…`). Here’s where `Numeric#quo` comes in – `10.quo(3)` returns the Rational `(10/3)`.
* `Regexp#~` matches a regular expression against the contents of `$_` (the last string read by `gets`). It returns index of the match.
* The Regexp `/$/` matches the end of the string, so `~/$/` means “print the index of the end of the string” – in other words, the string length. This gives us the final is a short-hand for the length of the string read by `gets`.
* This gives us the Rational (byte total/string length). Now we need to round it into an integer. `+0.5` casts the Rational to a float. `putc` floors the float into an integer.
[Answer]
# K, 36 bytes
```
`0:_ci_.5+{(+/x)%#x}'.0+1_|(-1_)\_ic
```
Usage:
```
  `0:_ci_.5+{(+/x)%#x}'.0+1_|(-1_)\_ic"Hello!"
HW^adY
  `0:_ci_.5+{(+/x)%#x}'.0+1_|(-1_)\_ic"test"
tmop
  `0:_ci_.5+{(+/x)%#x}'.0+1_|(-1_)\_ic"42"
43
  `0:_ci_.5+{(+/x)%#x}'.0+1_|(-1_)\_ic"StackExchange"
Sdccd_ccccddd
```
`_ci` and `_ic` convert ascii to chars and vice versa, respectively. `{(+/x)%#x}` is a classic K idiom for calculating a mean. Pretty straightforward overall.
Edit: oh, misread the spec. `0: is needed to print the result to stdout. Waiting for clarification on input re. Dennis' question.
[Answer]
## Python 2, 71
```
i=s=0
r=''
for c in input():s+=ord(c);i+=1.;r+=chr(int(s/i+.5))
print r
```
With each new character, updates the character sum `s` and the number of characters `i` to compute and append the average character.
[Answer]
# Mathematica, 75 bytes
```
FromCharacterCode@Floor[.5+Accumulate@#/Range@Length@#]&@ToCharacterCode@#&
```
[Answer]
# Julia, ~~85~~ 81 bytes
```
s->(i=[int(c)for c=s];print(join([char(iround(mean(i[1:j])))for j=1:length(i)])))
```
This creates an unnamed function that accepts a string and creates a vector of its ASCII code points. Means are taken for each sequential group, rounded to integers, converted to characters, joined into a string, and printed to STDOUT.
[Answer]
# Mathcad, 60 "bytes"
[![enter image description here](https://i.stack.imgur.com/BmOAh.jpg)](https://i.stack.imgur.com/BmOAh.jpg)
Mathcad is mathematical application based on 2D worksheets comprised of "regions" each of which can be text, a mathematical expression, program, plot or scripted component.
A mathematical or programming instruction is picked from a palette toolbar or entered using a keyboard shortcut. For golfing purposes, an operation ("byte") is taken to be the number of keyboard operations necessary to create a name or expression (for example, to set the variable a to 3, we would write a:=3. The definition operator := is a single keypress ":", as are a and 3 giving a total of 3 "bytes". The programming ***for*** operator requires typing ctl-shft-# (or a single click on the programming toolbar) so again is equivalent to 1 byte.
In Mathcad the user enters programming language commands using keyboard shortcuts (or picking them from the Programming Toolbar) rather than writing them in text. For example, typing ctl-] creates a while-loop operator that has two "placeholders" for entering the condition and a single line of the body, respectively. Typing = at the end of a Mathcad expressions causes Mathcad to evaluate the expression.
(Count bytes) By looking at it from a user input perspective and equating one Mathcad input operation (keyboard usually, mouse-click on toolbar if no kbd shortcut) to a character and interpreting this as a byte. csort = 5 bytes as it's typed char-by-char as are other variable/function names. The for operator is a special construct that occupies 11 characters (including 3 blank "placeholders" and 3 spaces) but is entered by ctl-shft-#, hence = 1 byte (similar to tokens in some languages). Typing ' (quote) creates balanced parentheses (usually) so counts as 1 byte. Indexing v = 3 bytes (type v[k).
[Answer]
# [Japt](https://github.com/ETHproductions/japt/), 11 bytes
```
c@V±X /°T r
```
[Try it](https://ethproductions.github.io/japt/?v=1.4.5&code=Y0BWsVggL7BUIHI=&input=IkhlbGxvISI=)
[Answer]
**PHP**, **176 byte**
```
<?=(implode('',array_reduce(str_split($argv[1]),function($c,$k){array_push($c[1],chr(floor(((ord($k)+$c[0])/(count($c[1])+1))+0.5)));return[ord($k)+$c[0],$c[1]];},[0,[]])[1]));
```
Example:
```
>php cg.php Hello!
HW^adY
>php cg.php test  
tmop
>php cg.php 42
43
```
The biggest solution so far, but based on php it can't get much shorter I think. 2 bytes could be saved by removing the newlines.
[Answer]
# [Zig](https://ziglang.org) 0.6.0, 84 bytes
```
fn a(b:[]u8)void{var t:u64=0;for(b)|c,i|{t+=c;b[i]=@intCast(u8,(t+(i+1)/2)/(i+1));}}
```
[Try it Online](https://godbolt.org/z/zoPvbW)
Formatted:
```
fn a(b: []u8) void {
    var t: u64 = 0;
    for (b) |c, i| {
        t += c;
        b[i] = @intCast(u8, (t + (i+1)/2) / (i+1));
    }
}
```
[Answer]
# PHP 7, 79 bytes
As I don't have enough reputation to comment on cb0's answer to provide him hints to improve his answer (mainly using the char index method in a string and while to loop through a string).
But I still bothered to post it due to the large reduction in byte count.
```
<?php $i=$b=0;while($a=ord($argv[1][$i++]??'')){$b+=$a;echo chr(round($b/$i));}
```
I didn't find a way though to use the `<?=` shortcut and avoid undefined errors without using command line flags (this is why i used `$i=$b=0;`). This answer does not work in PHP 5 due to the `??` syntax.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `s`, 7 bytes
```
CKvṁ.+C
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJzIiwiIiwiQ0t24bmBLitDIiwiIiwiSGVsbG8hIl0=)
`.+` should be `ṙ`, but there's a bug.
[Answer]
# [Knight](https://github.com/knight-lang/knight-lang), 62 bytes
```
;;=sP=i 0W<=i+1i+1Ls;=aGs=t 0i;Wa;=t+tAa=aGa 1LaO+A/+t/i 2i"\"
```
[Try it online!](https://tio.run/##rVltU9tIEv5s/4rBKWzJloMkuKotyzJFssBRRyALyeUD@BIhyzC1suyTZFiOkL@e6@550cg2ucvdUinLmumXp1@mu8eJ@7dx/P0Vz@J0OUmGRTnh89d3o6a5kvKb2lJcPi6SFaKcZ7e1pZLPBM0kmfIsYWnK0nl2Sx9Nvfrh7OM75lWvlx8umF@9/v3ggu1Vr0dnb9kv1evFR@ZVxEenlwbt2cdTg/Tj2buDy79Zhc0s/Gizb95fbL17cAlqxWZ8F@Wsa1cMJhVg1SJGI7ZX7Z0dfsLNDDbJoq8Mvw@HKzSohmjQTKBJUxsJazRvzs9PiQg/9snIAdpmALk4FgTAb2C9j9JlYttX2dhuNskOiMrVOLxoHZ4fWd@DICzeh5y5n4Yh73nw77QIwui4CEvm8uBTFIRlrzyIYCli3ml03jvY6ZU7nPm8dd36boOQViDkdkFwEs1YiBqCZhNgLKK8SCybPTUbPCsZD5oNWCVIDutOl1kMK8Qcw3s5WzjFIrvyx@GT67jPIKPBQRzRw9PFhZ0dFM8X7OGOl0mxiOKk2YDvaWLBOrBbAobDWtfldXY9vc7Z0/PV2LIHr1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Rn2DKSJmytcGWUNoiTdl/2ftC6wbIuL3PagS@pvBVo93ahLN60eapymMK0PDaVcVDWzb1kH2TU5YSzf/1v@GXNcgQo/mDzsCkro3Dq7RhVXXr2z994VEzcHXjQbpG7dajSyHRoMRxWOM2yiRyIEWvp9kE5E9gnvh5zBxIa9Yxc8aRbCf16R5JDf59f7BruOVYXC1CYxLrmQ1o/S6VyQuKo8/Cbm3wvRSOXhEarLY8f1PL27X1vOBr7j1a/A@DEwLDJ4Yi1pcEPTaZM5QPFqLWnofDFA0SIv/FJj2IoidPAmifJNMIiiRYpiZRnsEmn9CPTVFcQpvqbMcdnE1xxWYv3HZRmO6BMDXKHxxmEc9wqGVRfhs7JLTbhe/3Nv6sRfdQ/H8hyyU09eve8/e/JmDw1r8B "C (gcc) – Try It Online")
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 15 bytes
```
.pvyDSÇOsg/îç}J
```
[Try it online!](http://05ab1e.tryitonline.net/#code=LnB2eURTw4dPc2cvw67Dp31K&input=SGVsbG8h)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 13 bytes
```
£T±Xc)/°Y r d
```
[Test it online!](http://ethproductions.github.io/japt/?v=1.4.4&code=o1SxWGMpL7BZIHIgZA==&input=IkhlbGxvISI=)
### How it works
```
£   T± Xc)/° Y r d
mXY{T+=Xc)/++Y r d}
                     // Implicit: U = input string, T = 0
mXY{              }  // Replace each char X and index Y in the string by this function:
    T+=Xc            //   Add X.charCodeAt() to T.
         )/++Y       //   Take T / (Y + 1).
               r d   //   Round, and convert to a character.
                     // Implicit: output result of last expression
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 7 bytes
```
OÆmƤ+.Ọ
```
[Try it online!](https://tio.run/##y0rNyan8/9//cFvusSXaeg939/z//98DKJivCAA "Jelly – Try It Online")
```
OÆmƤ+.Ọ
O       - Get a list of character codes from the input string
   Ƥ    - Over prefixes:
 Æm     -  Get the mean
    +.  - To each, add 0.5
      Ọ - Convert from character codes to charcters. Decimals are rounded down.
```
[Answer]
# brev, 146 bytes
```
(as-list reverse(c pair-fold-right(fn(cons(integer->char(inexact->exact(floor(+(/(apply + x)(length x))0.5))))y))'())reverse(c map char->integer))
```
124 with banker's rounding:
```
(as-list reverse(c pair-fold-right(fn(cons(integer->char(round(/(apply + x)(length x))))y))'())reverse(c map char->integer))
```
Which is still a lot. It's clear that a huge painpoint in brev is the type converting (chars to integers, strings to lists etc).
[Answer]
# [Dart](https://www.dartlang.org/), 76 bytes
```
t(a,[c=1,s=0])=>String.fromCharCodes([...a.runes.map((i)=>(s+=i+.5)~/c++)]);
```
[Try it online!](https://tio.run/##RZA9b8MgEIb3/AqKOoDs0PRrcsgSVeqeoaosN0JAbFQbLMBRpcj96@7ZsZsbOODe5@4FJXwchkhEmkv@mAa@KSjfHaI3tmQn75p9JfzeKR1IzhgTzHdWB9aIlhADShISbhL2Sn8fZJLQgmbD2RmFGmEsoeiyQhBn4ZGxbRcD4ijH77qu3R1OEY46xDG/PI3rIQr5/fYjK2FLjYvsn3VdvMEfX0J9TnDj2gl@nmAlpTpKCKXUAp@cJ9NwQDcZpO3sg9XalrGCKzA9u1ymRd20oL8KczO3GqOFX4kE319GSY/WOwRbMh5oj@lNJ0LQHgrXEuJ8eQF0m2X9qh/@AA "Dart – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 22 bytes
```
(0.5<.@++/%#)\&.(3&u:)
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NQz0TG30HLS19VWVNWPU9DSM1UqtNP9rcqUmZ@QrpCmoe6Tm5OQrqsP5JanFJQieiRGCHVySmJztWpGckZiXnqr@HwA "J – Try It Online")
## Explanation
```
(0.5<.@++/%#)\&.(3&u:)
              &.(    )  do this, the left verb then the inverse of this:
                 3&u:     characters -> ordinates
(           )\          over the prefixes of the input:
        +/%#            take the average (sum divide length)
 0.5   +                add one-half
    <.@                 then floor   
```
[Answer]
# Matlab, ~~43~~ 31 bytes
*Thanks to [@beaker](https://codegolf.stackexchange.com/users/42892/beaker) for 9 bytes off!*
Using an anonymous function:
```
@(s)[cumsum(+s)./find(s)+.5 '']
```
Examples:
```
>> @(s)[cumsum(+s)./find(s)+.5 '']
ans =
  function_handle with value:
    @(s)[cumsum(+s)./(find(s))+.5 '']
>> f=ans;
>> f('Hello!')
ans =
    'HW^adY'
>> f('test')
ans =
    'tmop'
>> f('42')
ans =
    '43'
>> f('StackExchange')
ans =
    'Sdccd_ccccddd'
```
[Answer]
### Ruby 59 ~~61~~
```
->w{s=c=0.0;w.chars.map{|l|s+=l.ord;(s/c+=1).round.chr}*''}
```
Test: <http://ideone.com/dT7orT>
]