read for((;i<8;--a[A$s],++a[A$s=c+1])){ read s c||echo $[a[++i]] }