Skip to main content
2 of 5
added 74 characters in body
muru
  • 381
  • 1
  • 8

GNU awk, 79 75 bytes

gawk '{w+=NF;c+=length+1}END{d=length(c);printf "%"d"d %"d"d %d\n",NR,w,c}'

Edit: saved 4 bytes since POSIX allows a bare length

Better formatted:

gawk '{
  w += NF
  c += length($0) + 1  # length($0) misses the newline
}
END {
  d = length(c) # GNU awk's length returns the length of string representation of number
  printf "%"d"d %"d"d %d\n", NR, w, c
}'
muru
  • 381
  • 1
  • 8