1.1 Pooja's Greenhouse: Growing Success 🌱
Pooja is a young botanist working in a greenhouse where she has 26 different types of plants, labelled from 'A' to 'Z'. Each type of plant requires a certain amount of care time to fully grow:
Plant 'A' requires 1 minute of care,
Plant 'B' requires 2 minutes of care,
Plant 'C' requires 3 minutes of care,
and so on, up to Plant 'Z', which requires 26 minutes of care.
After a busy day at the greenhouse, you discover Pooja’s activity log—a string of letters where the i-th term of the string tells you which plant Pooja was taking care of during the i-th minute of her day.
To fully grow a plant, Pooja needs to spend the required number of minutes caring for that plant. However, she might continue to care for a plant even after it has fully grown, or she might switch between different plants throughout her day.
Given Pooja’s activity log, determine how many different types of plants she successfully grew by the end of the day.
Constraints
t(1≤t≤100)
n(1≤n≤500)
Input Format
The first line contains a single integer t — the number of testcases.
The first line of each testcase contains a single integer n —the total duration of Pooja’s workday spent on looking after the plants in minutes
The second line contains a string of length exactly n, consisting only of uppercase Latin letters, — Pooja's activity log.
Output Format
For each test case, print a single integer — the number of distinct types of plants Pooja successfully grew by the end of the day.
Example 1
Input:
3
6
ACBCBC
7
AAAAFPC
22
FEADBBDFFEDFFFDHHHADCC
Output:
3
1
4
Explanation:
It is self explanatory
Log In to solve the Question