while read s;do echo ${s:$[${s:1:1}==${s:2:1}?2:4]:1};done