# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Bear Limak is very much fond of chocolate. His mom wants her son to study hard and develop his skills. So she decided to give some tasks to her son. She offers Limak that if he can solve those tasks, then she will give him a chocolate as a reward. The task is, she will give him a string **S**. Limak has to find out which character appeared how many times in the given string.

Limak was just impressed by the offer. But all of his joy came to an end when he heard that there will be some special characters like **“* @ # % ^… “ and spaces “ “**. His mom knew that counting the characters is an easy task, but she wanted to make it a bit difficult job for Limak. So she asks Limak not to count the special characters and spaces. But counting the character is not an easy task at all, especially when it is during the final exam time. You are the best friend of Bear Limak. Being so much busy with study Limak asks you to solve the task for him and he promised that he will share half of the chocolates with you. Are you smart enough to help your best friend ?

First line will contain an integer **0<T<=10** denoting the number of test cases. Each test case will contain two lines. First line will contain **1<=N<=1000**, the length of string S. Second line will contain string S. S will contain lowercase English letters, special characters and spaces only.

For each test case print the test case number and the characters of S in **lexicographical** order with their occurrences in string **S**. If there is no valid character to count then print **-1**. Don’t forget to print a blank line after each test case. Check Sample for details.

Input | Output |
---|---|

1 5 abcde | Case 1: a - 1 b - 1 c - 1 d - 1 e - 1 |

76% Solution Ratio

BruteforcekidEarliest,

TIGERFtFastest, 0.0s

Antor_SarkerLightest, 0 B

mdvirusShortest, 211B

Login to submit