2. Java: Encryption Decryption Decrypt a message that was encrypted using the following logic: • First the words in the sentence are reversed. For example, "welcome to hackerrank" becomes "hackerrank to welcome". • For each word, adjacent repeated letters are compressed in the format . For example, "mississippi" becomes "mis2is2ip2i" or "baaa" becomes "ba3". Note the format is not applied for characters with frequency 1. Also, the frequency will be no greater than 9. Return the decrypted string. Example encrypted Message = 'world hel2o' Expand each word to get 'world hello'. Now reverse the words to get 'hello world', the return value. Function Description Complete the function decrypt in the editor below. decrypt has the following parameter(s): string encrypted Message: an encrypted string Returns string: the decrypted message Constraints • 1 s length of encryptedMessages 105 Character frequency counts in the encrypted string will be 9 or less. encrypted Message consists of words and spaces. Words consist of lower case English letters and digits from 0 to 9.
2. Java: Encryption Decryption Decrypt a message that was encrypted using the following logic: • First the words in the sentence are reversed. For example, "welcome to hackerrank" becomes "hackerrank to welcome". • For each word, adjacent repeated letters are compressed in the format . For example, "mississippi" becomes "mis2is2ip2i" or "baaa" becomes "ba3". Note the format is not applied for characters with frequency 1. Also, the frequency will be no greater than 9. Return the decrypted string. Example encrypted Message = 'world hel2o' Expand each word to get 'world hello'. Now reverse the words to get 'hello world', the return value. Function Description Complete the function decrypt in the editor below. decrypt has the following parameter(s): string encrypted Message: an encrypted string Returns string: the decrypted message Constraints • 1 s length of encryptedMessages 105 Character frequency counts in the encrypted string will be 9 or less. encrypted Message consists of words and spaces. Words consist of lower case English letters and digits from 0 to 9.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ
Related questions
Question
Java

Transcribed Image Text:2. Java: Encryption Decryption
Decrypt a message that was encrypted using the following logic:
• First the words in the sentence are reversed. For example, "welcome to hackerrank" becomes "hackerrank to
welcome".
• For each word, adjacent repeated letters are compressed in the format <character><frequency>. For example,
"mississippi" becomes "mis2is2ip2i" or "baaa" becomes "ba3". Note the format is not applied for characters with
frequency 1. Also, the frequency will be no greater than 9.
Return the decrypted string.
Example
encrypted Message = 'world hel2o'
Expand each word to get 'world hello'. Now reverse the words to get 'hello world', the return value.
Function Description
Complete the function decrypt in the editor below.
decrypt has the following parameter(s):
string encrypted Message: an encrypted string
Returns
string: the decrypted message
Constraints
• 1 s length of encrypted Messages 105
• Character frequency counts in the encrypted string will be 9 or less.
• encryptedMessage consists of words and spaces. Words consist of lower case English letters and digits from 0
to 9.
► Input Format For Custom Testing
▾ Sample Case 0
Sample Input For Custom Testing
seaside the to sent be to ne2ds army ten of team a
Sample Output
a team of ten army needs to be sent to the seaside
► Sample Case 1
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY
Expert Answers to Latest Homework Questions
Q: Such a drastic cultural transformation has the potential to cause employees to be overwhelmed,…
Q: Question 1: Critical Thinking; Communication; Empirical & Quantitative Skills
CT;COM;EQS - PHYS…
Q: Part: 1/2
Part 2 of 2
Using curved arrows, draw the mechanism for this reaction.
Check
8.
H
%
5
Ö…
Q: z =
i
Head, ft
A centrifugal pump is being used to transfer 140 °F water from a reservoir up a 42°…
Q: https://www.noaa.gov/news/spring-outlook-drought-to-expand-amid-warmer-conditions
Q: Predict the major organic product of the reaction below.
+
1. H₂O, OH,
, heat
NEC
2. H₂O
Q: Draw the skeletal structure of the alkyl bromide that would be necessary to synthesize the given…
Q: An industry of execising equipment and analyze its competitive landscape.
Identify the key…
Q: V
Decide whether each row is a set of resonance structures for a single molecule and select "yes" or…
Q: 3. Acetaminophen (Tylenol) is prepared by the reaction of 4-aminophenol with acetic
anhydride. Yes,…
Q: Predict the major products of this organic reaction:
OH
NaBH4
H
?
CH₂OH
Note: be sure you use dash…
Q: An industry of execising industry and analyze its competitive landscape.
Identify the key…
Q: https://youtu.be/sjeSEngKGrg?list=TLGGk4ExXmfmlukwMjEyMjAyNQ
Explain how the environment plays a…
Q: This is the structure of 1-hexyne.
Part 1 of 2
1-Hexyne reacts rapidly with CH3MgBr and a gas is…
Q: 1. A certain sedative is made by the reaction of diethyl propanedioate (a diester) with
urea. If we…
Q: Problem 1+
The square-wave inverter below has a de input of 150 V and supplies a series RL load with…
Q: For the full-bridge inverter, the dc source is 125 V, the load is a series RL connection with R = 10…
Q: Problem 3:<
A square-wave inverter has Vdc=125 V, an output frequency of 60 Hz, and a resistive load…
Q: www.integral-calculator.com
Q: The full-bridge inverter below has a DC input voltage of 100V, a load resistor of 10 Q2, and an…
Q: we learned the various response strategies for threats and opportunities. discuss how is it done,…