Your question is Count Characters Words Lines. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Yugabyte tooling may need lightweight statistics for text returned by command-line diagnostics. Given a string of text, count its characters, words, and lines in a single pass.
A character is every Unicode code point in the input, including spaces, tabs, and newline characters. A word is a maximal consecutive sequence of non-whitespace characters. Whitespace is determined by Python's str.isspace() behavior. Lines are separated by the newline character . An empty string contains zero lines; otherwise, its line count is one plus the number of characters.
Implement count_text_stats(text), where text is a Python string. Return a dictionary with exactly these keys:
characters: total number of characterswords: number of whitespace-delimited wordslines: number of linesdef count_text_stats(text):