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.
Be the first one to answer
Add answer anonymously...
Bharti Airtel Software 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