Skip to main content
added 13 characters in body
Source Link
roblogic
  • 4k
  • 18
  • 23

Zsh, 32 bytes

echo ${(wf)#S} ${(w)#S} $[$#S+1]

Try it online!

Using Zsh parameter expansion flags. (f) splits a string on newlines. (w) counts 'words' in a string;an array (or #string); usually space delimited, but with (s) or (f) flags the 'words' can be delimited by other separators. And finally $#S counts the bytes in string S, but omits the terminating null byte so I had to add 1 to match the result from wc.

Zsh, 32 bytes

echo ${(wf)#S} ${(w)#S} $[$#S+1]

Try it online!

Using Zsh parameter expansion flags. (f) splits a string on newlines. (w) counts 'words' in a string; usually space delimited, but with (s) or (f) flags the 'words' can be delimited by other separators. And finally $#S counts the bytes in string S, but omits the terminating null byte so I had to add 1 to match the result from wc.

Zsh, 32 bytes

echo ${(wf)#S} ${(w)#S} $[$#S+1]

Try it online!

Using Zsh parameter expansion flags. (f) splits a string on newlines. (w) counts 'words' in an array (or #string); usually space delimited, but with (s) or (f) flags the 'words' can be delimited by other separators. And finally $#S counts the bytes in string S, but omits the terminating null byte so I had to add 1 to match the result from wc.

Source Link
roblogic
  • 4k
  • 18
  • 23

Zsh, 32 bytes

echo ${(wf)#S} ${(w)#S} $[$#S+1]

Try it online!

Using Zsh parameter expansion flags. (f) splits a string on newlines. (w) counts 'words' in a string; usually space delimited, but with (s) or (f) flags the 'words' can be delimited by other separators. And finally $#S counts the bytes in string S, but omits the terminating null byte so I had to add 1 to match the result from wc.