# DCP-365: Decrypt The Secret Message Back to All Problems

Easy Beginners Problems > Ad-hoc

Once upon a time there was a famous person named Saadat Chowdhury. He is so much intelligent. One day he invented an algorithm which become popular within few days. His algorithm works on encryption decryption mechanism. For Example, "**LLEELLEELLEELFFTTFTTFHFHIHIM**" **2** **4 3** This secret message without double quotation if passed into his algorithm than it generates the original message of exactly two words of length 4 and length 3. And original message is **LEFT HIM**. (The original message always contains distinct characters) Which means that **largest character occurrences** will be the first character than the second largest one will be the second one and so on. And first **four characters** will makes a word and then **a space** than the last **three characters** makes second word. **If two or more different characters number of occurrence become same than print the characters in alphabetically ascending order**. One day Saadat give few encrypted message to his student and asked him what will be the original message. Now your task is to help the student to decrypt the secret message. ***Note: It is assured that each encrypted message has exactly one valid solution.*** Input: ------ The first line will contain the test case **T(T<=10)** and the next line will contain an encrypted message **S**. The message will contain uppercase english letters and the length of the secret message does not exceed **400 characters**. And the next line contain a number **N(1<=N<=10)** which is the total number of words in the **original message**. And the next line will contain **ith** word length **Li**. For more specifications see the sample input. Output: ------- The output will be start by the case number like "**Case x:** " without double quotation where **x** denotes the case number. And after that the original message of the encrypted message according to the method mentioned in problem description. For more specifications see the sample output. Sample Input ------------ 2 LLEELLEELLEELFFTTFTTFHFHIHIM 2 4 3 HHHHHHHIIIII 1 2 Sample Output ------------- Case 1: LEFT HIM Case 2: HI

### Problem Limits

 Language Time Limit (seconds) C 1.00 C++ 1.00 C++14 1.00 C# 2.00 Go 2.00 Java 2.00 JavaScript 2.00 Objective-C 2.00 Perl 2.00 PHP 2.00 Python 2.00 Python3 2.00 Ruby 2.00 VB.Net 2.00

# 42/152

Solve/Submission

### Ranking

# User Language Timing
01 subhashis_cse Cpp 0.00s
02 Reayz Cpp 0.00s
03 mhiceiuk Cpp 0.00s
04 ssavi Cpp 0.00s
05 haasib Cpp 0.00s
06 nurshuvo51 Cpp 0.00s
07 Sarwar05 Cpp 0.00s
08 akram Cpp 0.00s
09 mahbub07 Cpp 0.00s
10 njrafi Cpp 0.00s
11 jayed_al_hasan Cpp 0.00s
12 ____ Cpp 0.00s
13 shamimjucse Cpp 0.00s
14 yasirnabil534 Cpp 0.00s
15 yakin Cpp 0.00s
16 Trusted_Frustrated Cpp14 0.00s
17 SakibAlamin Cpp14 0.00s
18 Aman_khan Cpp 0.00s
19 afzalul C 0.00s
20 rayhan50001 Cpp14 0.00s
21 feodorv C 0.00s
22 Pure_Protea Cpp 0.00s
23 FahimSifnatul Cpp 0.00s
24 kissu_pari_na Cpp 0.00s
25 cse_nazmul Cpp 0.00s
26 showmic Cpp 0.00s
27 Morass Cpp14 0.00s
28 rummanrakib11 Cpp14 0.00s
29 sazal_dev Cpp 0.00s
30 souravahmed C 0.00s
31 tariqiitju Cpp 0.00s
32 SkSaber Cpp14 0.01s
33 nasib_mbstu Cpp14 0.01s
34 emrul Cpp14 0.01s
35 a_rahman Cpp 0.01s
36 deder Cpp 0.01s
37 anik_JU Cpp 0.01s
38 Logic_Hunter Cpp14 0.01s
39 indroneel Cpp 0.01s
40 aseem_cu Cpp14 0.01s
41 RandyWaterhouse Python3 0.03s
Feedback