A JSON array is provided in one line, like [1,2,true,null]. Count how many numbers, strings, booleans, and null values. Output counts in order: num str bool null.
• First line: A JSON array in one line
• Example: [1,2,true,null]
• Print four integers separated by space:
• Count of numbers
• Count of strings
• Count of booleans
• Count of null values
Order:
num str bool null
• Input is a valid JSON array
• Length ≤ 10^5
Array elements:
1 → number
"hello" → string
true → boolean
null → null
5 → number
false → boolean
"abc" → string
Counts:
Numbers = 2
Strings = 2
Booleans = 2
Null = 1
1.Read the input line as string.
2.Use json.loads() to parse it into a Python list.
3.Initialize counters:
• num = 0
• str_c = 0
• bool_c = 0
• null_c = 0
4.Loop through each element in the list:
• If type is int or float → increase num.
• If type is str → increase str_c.
• If type is bool → increase bool_c.
• If value is None → increase null_c.
5.Print counts in order:
num str_c bool_c null_c.