Most word processors show some properties of the text in a document, such as the number of words or the number of letters in that document. Write a program that can determine some of these document properties.
The first line of the input contains an integer $$t \in \mathbb{N}$$. This is followed by $$t$$ lines of text. This text consists of:
lowercase letters (a-z) en uppercase letters (A-Z)
dash (-): though it may be between two spaces, it is not counted as a word
apostrophe ('): in the (English) text only used to indicate the contraction of two words; the fragment "It's" contains two words
other characters: punctuation marks such as (,),!? still cling to a word
white space (spaces and tabs): with the exception of the rules on the dash and the apostrophe, so you can always assume that there is at least one character white space between two words
Write the following information on separate lines to the output:
sections: p, where $$p$$ represents the number of sections in the text; between two sections there is exact one blank line
lines: r, where $$r$$ is the number of lines in the text
words: w, where $$w$$ is the number of words in the text
characters: k, where $$k$$ is the number of characters in the text (exclusive of the characters used at the end of the line)
letters: l, where $$l$$ is the number of characters from the alphabet; do not distinguish between uppercase and lowercase letters
white space: i, where $$i$$ is the number of spaces and tabs
other: o, where $$o$$ is the number of characters which not a letter, space or tab; in other words: $$k = l + i + o$$
Input:
3
A - simple? - test
To show it's (more or less) working.
Output:
sections: 2
lines: 3
words: 11
characters: 54
letters: 37
white space: 10
other: 7
Input:
2
This sentence has two spaces between some words and contains "quotations"
Output:
sections: 1
lines: 2
words: 13
characters: 87
letters: 69
white space: 14
other: 4
Input:
49
Some things in life are bad
They can really make you mad
Other things just make you swear and curse.
When you're chewing on life's gristle
Don't grumble, give a whistle
And this'll help things turn out for the best...
And...
Always look on the bright side of life...
Always look on the light side of life...
If life seems jolly rotten
There's something you've forgotten
And that's to laugh and smile and dance and sing.
When you're feeling in the dumps
Don't be silly chumps
Just purse your lips and whistle - that's the thing.
And...
Always look on the bright side of life...
Always look on the light side of life...
For life is quite absurd
And death's the final word
You must always face the curtain with a bow.
Forget about your sin - give the audience a grin
Enjoy it - it's your last chance anyhow.
So always look on the bright side of death
Just before you draw your terminal breath
Life's a piece of shit
When you look at it
Life's a laugh and death's a joke, it's true.
You'll see it's all a show
Keep 'em laughing as you go
Just remember that the last laugh is on you.
And always look on the bright side of life...
Always look on the right side of life...
(Come on guys, cheer up!)
Always look on the bright side of life...
Always look on the bright side of life...
(Worse things happen at sea, you know.)
Always look on the bright side of life...
(I mean - what have you got to lose?)
(You know, you come from nothing - you're going back to nothing.
What have you lost? Nothing!)
Always look on the right side of life...
Output:
paragraphs: 8
lines: 49
words: 307
characters: 1571
letters: 1149
white space: 332
other: 90