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

Given a string, find the frequency of each character from 'a' to 'z' in the string.

  • Create an array of size 26 to store the frequency of each character from 'a' to 'z'.

  • Iterate through the string and in...read more

Help your peers!
Select
Add answer anonymously...

Bharti Airtel Software Developer interview questions & answers

A Software Developer was asked 1d agoQ. What does a software developer do?
A Software Developer was asked 1d agoQ. What are your skills?
A Software Developer was asked 1d agoQ. What is Android with Java?

Popular interview questions of Software Developer

A Software Developer was asked 1d agoQ1. What does a software developer do?
A Software Developer was asked 1d agoQ2. What are your skills?
A Software Developer was asked 1d agoQ3. What is Android with Java?
Bharti Airtel Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits