read s
len=${#s}
p=${s:0:1}
c=1
i=1
while((i<len))
do
    if((${#p}==2))
    then
        p=${s:i:1}
        i=$((i+1))
    elif [ $p = ${s:i:1} ]
    then
        if((i==len-1))
        then
            break
        else
            p=${s:i:2}
            i=$((i+2))
        fi
    else
        p=${s:i:1}
        i=$((i+1))
    fi
    c=$((c+1))
done
echo $c
