F= ->w{s=c=0.0;w.chars.map{|l|s+=l.ord;c+=1;(s/c).round.chr}*''} p F['Hello!'] p F['test'] p F['42'] p F['StackExchange']