a[1<<24];*p=a,*q;M=4e3,s;main(t){for(;t=~getchar();q++)s=t+36?t&4?q=p+=M:0,s:fmax(s,q[M+1]=fmin(fmin(*q,q[1]),q[M])+1);printf("%d",-~s/2);}