#!/usr/bin/perl
use 5.016;
use warnings;
sub chunk {
my @l;
foreach(0 .. $#_){
push @{$l[$_ / $n]}, $_[$_]; }
}
sub _f
{ map{ $_->[1] . len
($_->[0]) } chunk
(2, shift =~ m/\G((.)\2*)/g) }
sub f
{ length $_[0] ? _f
($_[0]) : 0 }
while(<STDIN>){
say f($_);
}
IyEvdXNyL2Jpbi9wZXJsCnVzZSA1LjAxNjsKdXNlIHdhcm5pbmdzOwoKc3ViIGNodW5rIHsKCW15ICRuID0gc2hpZnQ7CgoJbXkgQGw7Cglmb3JlYWNoKDAgLi4gJCNfKXsKCQlwdXNoIEB7JGxbJF8gLyAkbl19LCAkX1skX107Cgl9CgoJcmV0dXJuIEBsOwp9CgpzdWIgbGVuIHsgbGVuZ3RoKCRfWzBdKSA+IDEgPyBsZW5ndGgoJF9bMF0pIDogJycgfQoKc3ViIF9mIHsgbWFweyAkXy0+WzFdIC4gbGVuKCRfLT5bMF0pIH0gY2h1bmsoMiwgc2hpZnQgPX4gbS9cRygoLilcMiopL2cpIH0KCnN1YiBmIHsgbGVuZ3RoICRfWzBdID8gX2YoJF9bMF0pIDogMCB9Cgp3aGlsZSg8U1RESU4+KXsKCWNob21wOwoJc2F5IGYoJF8pOwp9Cg==