x[];char s[99];main(i,j,c,a){i=j=0;x[j]=0;while(c=getchar()+1){s[i++]=--c<33?a=i,i=-1,0:(a=0,x[j]+=c*c,c);if(a){for(a=0;a