Q2: Secret Courses Dan’s recently announced that he’s teaching n top-secretcourses nextsemester. Instead of enrolling in them through ACORN, students need to email Dan to express theirinterests. These courses are numbered from 1 to n in some arbitrary order. In particular, if a student named s is interested in taking a course c, they need to send an email to Dan containing the message c s. Note that if a student is interested in taking multiple courses, they need to send multiple emails, one per course. Upon receiving a message c s, Dan looks at the list of students already enrolled in course c. If there’s already a student on the list whose name is too similar to s, Dan assumes s is the same student and ignores the message. Otherwise, he enrolls s in the course. Dan considers two names too similar if and only if they have the same length and differin at most one letter(note that“a” and “A” are considered the same letter). For example, “Josh” and “Josh” are too similar. “Sam” and “CaM” are too similar as well. However, neither“Max” and “Cat” nor“Ann” and “Anne” are too similar. Dan has a lot of students and teaches a lot ofcourses. Consequently, it would take him foreverto process the messages sent by the students one-by-one manually. Instead, he’s asking you to help him out by writing a
Input The first line of the inputconsists of two space-separated integers n and m, denoting the number of secretcourses Dan is teaching nextsemester and the number of messages sent by the students, respectively. The m messages will be described in the following m lines in chronological order. The i-th line describes the i-th message and consists of an integer c_i followed by a string s_i. This indicates that a student named s_i wants to enrol in course c_i. Output You should output exactly n lines. The i-th line should contain the names of the students enrolled in the i-th course in the order of enrolment (note that the line would be empty if there were no students enrolled in the course). These names should be separated by single spaces. Sample Input 1
2 6
1 alex
1 Alex
2 sam
1 alix
1 Alix
2 caM
Sample Output 1
alex
sam
Sample 1 Explanation The first line of the input indicates that there are 2 courses and 6 messages to process. Dan ignores the second, fourth, fifth, and sixth messages. The second, fourth, and fifth messages are all ignored because “Alex”, “alix”, and “Alix” are all too similar to “alex”. The sixth message is ignored because “caM”is too similar to “sam”.
Sample Input 2
3 16
3 jun
3 Jin
1 Li
2 Kitty
2 Josh
3 Bob
1 Dave
2 Jose
1 David
3 Rob
3 Anne
3 Ann
2 Kevin
2 Lara
1 ALI
3 Xin
Sample Output 2
Li Dave David ALI
Kitty Josh Kevin Lara
jun Bob Anne Ann Xin
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- Q2. Find out who got the highest score. Enter your formula into B13. 1 ID NAME SCORE 1 S1 93 2 S2 88 4. 3 S3 47 5. 4 S4 65 5 S5 6 S6 6. 41 7. 47 7 57 32 9. 8 S8 57 10 9 S9 89 11 10 S10 25 12 13 NAME: 14 H SCORE:arrow_forwardReplace all the 0 (Zero) digits in your ID by 4. Example: If your ID is 382200448 , it becomes 382244448 Take the first 6 digits and substitute them in this expression (( A + B) / C) * ((D-E)/F)-2) according to the following table; [1 mark] Letter Replace by Digit Example Digit A 1st 3 B 2nd 8 C 3rd 2 D 4th 2 E 5th 4 F 6th 4 After substitution your expression ? Draw a rooted tree that represents your expression. [3 marks] What is the prefix form of this expression. [3 marks] What is the value of the prefix expression obtained in step 2 above? [3 marks]arrow_forwardCHALLENGE ACTIVITY Jump to level 1 Integers numCookies and cash are read from input. A cookie costs 3 dollars. If numCookies is less than 5, output "numCookies requires at least 5 to purchase." • If numCookies is greater than or equal to 5, then declare and initialize int variable totalCost with the product of numCookies and 3. 17 18 19 20 21 22 23 24 25 26 27 End with a newline. Ex: If the input is 13 63, then the output is: Successful purchase! www W N N N 28 600 29 30 ENTO 31 Detecting multiple features with branches. • If totalCost is less than or equal to cash, output "Successful purchase!" • Otherwise, output "Need more money to purchase all." If numCookies is greater than 34, output "Restocking soon." 32 } 33 } int totalCost = 0; if (numCookies >= 5) { } else if (totalCost 34) { System.out.println("Restocking soon"); } 1 2 3arrow_forward
- A Boolean operator may be used to find information on two different subjects at the same time. Which of the following Boolean operators should Kevin use to receive the best search results?arrow_forwardWho Wants to Be a MillionaireYour final project will be to create a quiz game similar to “Who Wants to bea Millionaire?”Requirements:• Your game will include 5 questions.• You will ask the user multiple choice questions (in increasing difficultyif possible).• Each question, if answered correctly, will have a point value attached toit. The point values should be as follows: 100, 200, 500, 1000, 2000.• Unlike the game on T.V., the score will be an accumulation of the pointsearned throughout the game and the user may continue if he/she answersincorrectly.Show the user’s point total after each question.• At the end of the game, the user should be given the option to play againif he/she chooses.• Include a text file called “highscore.txt” that stores the highestscoring player’s first name and score.Update the text file if the user scores the highest score.• Include at least three functions in your program.Input Validation: The user must choose valid options from menus.Grading Criteria:1.…arrow_forwardCrypto Columns The columnar encryption scheme scrambles the letters in a message (or plaintext) using a keyword as illustrated in the following example: Suppose BATBOY is the keyword and our message is MEET ME BY THE OLD OAK TREE. Since the keyword has 6 letters, we write the message (ignoring spacing and punctuation) in a grid with 6 columns, padding with random extra letters as needed: MEETME BYTHEO LDOAKT REENTH Here, we've padded the message with NTH. Now the message is printed out by columns, but the columns are printed in the order determined by the letters in the keyword. Since A is the letter of the keyword that comes first in the alphabet, column 2 is printed first. The next letter, B, occurs twice. In the case of a tie like this we print the columns leftmost first, so we print column 1, then column 4. This continues, printing the remaining columns in order 5, 3 and finally 6. So, the order the columns of the grid are printed would be 2, 1, 4, 5, 3, 6, in this case. This…arrow_forward
- pls help me java webarrow_forward~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~arrow_forwardCreate a chatbot that takes input questions from the user converts that input question to a list and then matches that question list with already saved appropriate (suitable) answer list.Try to save two to three appropriate answers in list for a single question then for random selection of elements from those answers use random choice(list) method from random module that returns a random element. Also for a user question that doesn't matches with any of the answers present in the chat box it should display statement like "oops i can't answer that" "sorry i am not intelligent enough" "could u please ask something else" using random method so that every time one of these statements appear **coding language python **(hint) take the question as input from the user and then give answer for that question. You can make use of find function to see any matching words for which you are providing answers or can use any other similar method ***try using basic programming techniques in…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education