DCP-8: Get the Numbers Back to All Problems

Easy Beginners Problems > Ad-hoc

One of our clients sent some SMS to some mobile numbers (of his customers). After he sent the SMS campaign, he wants to know which mobile numbers successfully received the SMS and which didn’t. His plan is to remove the undelivered mobile numbers from his list and only keep the one that successfully received the SMS so that when he send SMS next time the cost is reduced. Also he can contact the failed mobile number customers to correct their mobile numbers. But unfortunately when he went to the delivery report section of the SMS marketing service, he found that for security purpose in the delivery report it replaced some digits of the mobile numbers with star character (*). The amount of characters it replaced is fixed for all numbers though. Now the client came to us for help and asked us to provide a way to get back the original numbers with the status of delivery. We told the client that the recovery may not be 100% accurate and client is happy with that if we can recover the majority of the numbers and can indicate for which numbers we are confused. Client will provide us his original mobile number list to which he sent the campaign and will provide the delivery report where he has the stared out mobile numbers along with the status of delivery. You have to create two lists, one for the successfully delivered numbers and the other for failed numbers. In case you are unable to predict the number because there are multiple possibilities, you have to print “Confused” for those numbers. You can assume that the two lists client provided will have same amount of numbers and can assume the original number list had all unique numbers. Input: ------ Input starts with an integer **T (≤ 10)**, denoting the number of test cases. The each **T** test cases next, there will be a positive integer **X (<=100)** in a line which denotes the amount of mobile numbers in original list and in the delivery report. Then there will be **X** lines each having the original mobile numbers. After this there will be another **X** lines each having the stared out mobile number and status of delivery separated by comma (,). The status values are “Success” and “Failed” without the quotation marks. Each test case will be separated by a blank line. Remember for all test cases 4th to 7th digits in the mobile number will be stared out. Mobile numbers considered to have digits only. It should not have any dash (-) or space in between. But do not predict it to be Bangladeshi mobile number always. It can have length of 10 to 20 and when not stared it will only have digits. Output: ------- For each test case, print the case number as: “**Case: C**” where **C** denotes the test case sequence number in a line. Then print a line: “Success list” without quotation marks. Then print each mobile numbers which was in status “Success” as “**SN : ON**” without quotation (SN denotes stared out number, ON denotes original number). Then print a line “Failed list” without quotation marks and it follows the mobile numbers which was in status “Failed” as “SN : ON” without quotation (SN, ON denotes same as above). If any number is uniquely unpredictable (because, stared out number match multiple original numbers) then print “SN : Confused” without quotation. You should output these lists according to the order in which you have taken the delivery report (stared out number list) as input as it will help the client to compare our output with his delivery report to verify your conversion. Please check the sample input output for further clarification about input / output format. Sample Input ------------ 3 5 01717171717 01818181818 01919191919 01616161616 01111111111 016****1616,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success 5 01717171717 01818181818 01919191919 01919191918 01111111111 019****1918,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success 5 01717171717 01818181818 01919191919 01918191919 01111111111 019****1919,Success 017****1717,Failed 018****1818,Success 019****1919,Failed 011****1111,Success Sample Output ------------- Case: 1 Success list 016****1616 : 01616161616 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : 01919191919 Case: 2 Success list 019****1918 : 01919191918 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : 01919191919 Case: 3 Success list 019****1919 : Confused 018****1818 : 01818181818 011****1111 : 01111111111 Failed list 017****1717 : 01717171717 019****1919 : Confused

Problem Setter:

MD. Jalal Uddin

Please login to submit solution to this problem.

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

Problem Stats




# User Language Timing
01 rithu Cpp14 0.00s
02 afzalul Cpp14 0.00s
03 mrinmoi Cpp 0.00s
04 feodorv C 0.00s
05 emrul Cpp14 0.00s
06 souravahmed C 0.00s
07 Robbinb1993 Cpp14 0.00s
08 Azaxdev Cpp 0.00s
09 sj_rifat Cpp 0.00s
10 ICT_backbencher Cpp 0.01s
11 Zeerin Cpp 0.01s
12 khmahbub20 Cpp 0.01s
13 rashedul007 Cpp 0.01s
14 Ehsanul_Fahad Cpp 0.01s
15 duronto20 Cpp 0.01s
16 MRoy Cpp14 0.01s
17 abdulmukit Cpp 0.01s
18 1504038_arafath Cpp 0.01s
19 haasib Cpp14 0.01s
20 ash12 Cpp14 0.01s
21 sadia2427 Cpp14 0.01s
22 smriad Cpp14 0.01s
23 Masum_ice Cpp14 0.02s
24 khairul021 CSharp 0.02s
25 aust_anik CSharp 0.02s
26 rayhan50001 Cpp 0.02s
27 ayantt CSharp 0.02s
28 sajidk25 CSharp 0.02s
29 armanabdullah CSharp 0.02s
30 akmrafiq CSharp 0.02s
31 BlueEye Cpp14 0.03s
32 ashrafulais CSharp 0.03s
33 zahidbiscj CSharp 0.03s
34 shahed_iu CSharp 0.03s
35 Masudcse CSharp 0.03s
36 mahbub_9 CSharp 0.03s
37 samir143009 CSharp 0.03s
38 nobelrakib CSharp 0.03s
39 lazyfahim CSharp 0.03s
40 noyonhossen CSharp 0.04s
41 hossaintanbir0 CSharp 0.05s
42 fahimali CSharp 0.05s
43 keiuom CSharp 0.05s
44 Atm_Ahad CSharp 0.06s
45 Alpha CSharp 0.06s
46 RandyWaterhouse Python3 0.06s
47 masba Python 0.07s
48 anower CSharp 0.07s
49 taen CSharp 0.07s
50 mahmudkoli CSharp 0.07s

Your feedback is our precious!

Or call +88 02 9853138 for support