Post History
In Google Docs, the word count tool looks like this: Pages would not make sense, but your goal is to implement every other count. Definitions Words are strings of text separated by any amount ...
#5: Post edited
Word Count Tool
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text, or a list of strings instead of a multiline string if you wish.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " -> [0, 3, 0]
- ```
This is code golf, so shortest code wins.
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text, or a list of strings instead of a multiline string if you wish.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " -> [0, 3, 0]
- ```
- This is <a class="badge is-tag">code golf</a>, so shortest code wins.
#4: Post edited
Word Count Tool
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text, or a list of strings instead of a multiline string if you wish.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
" " > [0, 3, 0]- ```
- This is code golf, so shortest code wins.
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text, or a list of strings instead of a multiline string if you wish.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " -> [0, 3, 0]
- ```
- This is code golf, so shortest code wins.
#3: Post edited
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
A string of text.- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " > [0, 3, 0]
- ```
- This is code golf, so shortest code wins.
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text, or a list of strings instead of a multiline string if you wish.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " > [0, 3, 0]
- ```
- This is code golf, so shortest code wins.
#2: Post edited
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
**Characters** are all printable bytes. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.- # Input
- A string of text.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " > [0, 3, 0]
- ```
- This is code golf, so shortest code wins.
- In Google Docs, the word count tool looks like this:
- ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb)
- Pages would not make sense, but your goal is to implement every other count.
- # Definitions
- **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines).
- **Characters** are all printable bytes*. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same.
- *I define printable bytes as the variable string.printable in Python, which is shown below.
- ```
- >>> string.printable
- '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ```
- # Input
- A string of text.
- # Output
- The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like.
- # Examples
- ```
- Input -> [words, characters, characters without spaces]
- "Hello world" -> [2, 11, 10]
- "H3ll0 w0r1d" -> [2, 12, 10]
- "Hello \t\nworld" -> [2, 12, 11]
- "\n\n\n" -> [0, 0, 0]
- " " > [0, 3, 0]
- ```
- This is code golf, so shortest code wins.
#1: Initial revision
Word Count Tool
In Google Docs, the word count tool looks like this: ![Word count](https://codegolf.codidact.com/uploads/Howm5Y9o42uzdnEsnNrU1PHb) Pages would not make sense, but your goal is to implement every other count. # Definitions **Words** are strings of text separated by any amount of whitespace (spaces, tabs, newlines). **Characters** are all printable bytes. For the sake of this challenge, you may assume all inputs will consist of printable bytes. Note that Google Docs does not count newlines in its character count, so you must do the same. # Input A string of text. # Output The 3 counts (words, characters, characters without spaces) in any order, and in an array if you like. # Examples ``` Input -> [words, characters, characters without spaces] "Hello world" -> [2, 11, 10] "H3ll0 w0r1d" -> [2, 12, 10] "Hello \t\nworld" -> [2, 12, 11] "\n\n\n" -> [0, 0, 0] " " > [0, 3, 0] ``` This is code golf, so shortest code wins.