Character Counting Challenge

Create a program that counts and prints the total number of specific character types from user input. Specifically, you need to count lowercase English alphabets, numeric digits (0-9), and whitespace characters (including space, tab ' ', and newline ' '). The counting should continue until the character '$' is encountered, which signals the end of input.

Input:

A continuous input stream of characters ending with '$'

Output:

Three integers representing the number of lowercase alphabets, digits, and white spaces, separated by spaces.

Example:

Suppose the input is as follows:

abc 123
	$

The output should be:

3 3 3

Constraints:

  • The input stream can contain any printable ASCII character.

Note: Only implement the logic to read the input and perform the counting; the program should not print anything directly.

Be the first one to answer
Add answer anonymously...
Snap-on Business Solutions Full Stack Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter