Character Frequency Problem Statement
You are given a string 'S' of length 'N'. Your task is to find the frequency of each character from 'a' to 'z' in the string.
Example:
Input:
S : abcdg
Output:
1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Input Format:
The first line of the input contains an integer 'T' denoting the number of test cases. The next 'T' lines, each contain one string 'S'.
Output Format:
For each test case, output a single line containing 26 space-separated integers, where the 'i'th integer represents the frequency of the 'i'th character.
Constraints:
- 1 ≤ T ≤ 102
- 1 ≤ Length of the given string ≤ 104
- All characters in the string are lowercase English alphabets.
- Time Limit: 1 sec
Note:
You don’t have to print anything; the printing is already managed. Just implement the required function.

AnswerBot
4mo
The task is to find the frequency of each character from 'a' to 'z' in a given string.
Create an array of size 26 to store the frequency of each character from 'a' to 'z'.
Iterate through the given stri...read more
Help your peers!
Add answer anonymously...
Hewlett Packard Enterprise Software Developer interview questions & answers
A Software Developer was asked Q. Design a classroom management system.
A Software Developer was asked Q. How well can you adapt to changes in technology used for a project? Explain your...read more
A Software Developer was asked Q. Please brief me about the ITIL framework and how it helps in application managem...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. Given a string, return the character counts. For example, input 'aabbbc' should ...read more
A Software Developer was asked Q2. Design a classroom management system.
A Software Developer was asked Q3. How well can you adapt to changes in technology used for a project? Explain your...read more
>
Hewlett Packard Enterprise Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

