string checking methods

When dealing with strings, it’s also important to check if some conditions hold. Below are several popular methods that are used to check for some conditions in a string:
Method
Description
Examples
Results
isupper()
Check if all the letters are uppercase
'Anna'.isupper() 'ANNA'.isupper() 'AnnA'.isupper()
False True False
islower()
Check if all the letters are lowercase
'Anna'.islower() 'anna'.islower() 'AnnA'.islower()
False True False
istitle()
Check if all the words start with uppercase and are followed by lowercase letters
'Anna'.istitle() 'anna'.istitle() 'AnnA'.istitle() '19'.istitle()
True False False False
isdigit()
Checks if all the characters are numbers
'Anna'.isdigit() '1997'.isdigit() 'An97'.isdigit() '19'.isdigit()
False True False True
isalpha()
Checks if all the characters are alphabetical
'Anna'.isalpha() '1997'.isalpha() 'An97'.isalpha() 'Hi Anna'.isalpha()
True False False False
isalnum()
Checks if all the characters are either alphabetical or numeric
'Anna'.isalnum() '1997'.isalnum() 'An97'.isalnum() 'Hi Anna'.isalnum()
True True True False
startswith('xxx')
Check if the string starts with 'xxx'
'Anna'.startswith('A') 'Anna'.startswith('a') 'Anna'.startswith('') 'Anna'.startswith('An')
True False True True
endswith('xxx')
Check if the string ends with 'xxx'
'Anna'.endswith('A') 'Anna'.endswith('a') 'Anna'.endswith('') 'Anna'.endswith('nA')
False True True False
isspace()
Checks if all the characters are whitespace characters (\t, \n, space, etc)
'Anna'.isspace() ' '.isspace() ' \t \n'.isspace() ' \t hi'.isspace()
False True True False
Bear in mind that memorizing these methods is not necessary. Despite the names being very intuitive, a short googling will lead you to the method you actually need. This small table is just a fraction of the useful methods to demonstrate what is possible with a single line of Python code.
Note that string does not have contains() method as there is already an in keyword present which checks if one string is contained in another.

Challenge

Given a string, count the number of uppercase, the number of lowercase, and the number of space letters.
The input contains a single line of text which needs to be analyzed.
The program should print a single line with 3 numbers - the number of uppercase letters, the number of lowercase letters, and the number of space letters.
Input
Output
Hey, how are you doing today Anna?
2 24 6
Amazing job with the infrastructure setup Bob!
2 37 6
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue