Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question
Java ASAP
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 wi
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.
• encrypted Message consists of words and spaces. Words consist of lower case English letters and digits from 0
to 9.
✓ Input Format For Custom Testing
A single line of input consists of a string, encryptedMessage.
✓ 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
Sample Input For Custom Testing
a3b4q21 abcd2 abc
Sample Output
abc abcdd aaabbbbqqi
Info
Java 8
✔ Autocomplete Ready Ⓒ
expand button
Transcribed Image Text: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 wi 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. • encrypted Message consists of words and spaces. Words consist of lower case English letters and digits from 0 to 9. ✓ Input Format For Custom Testing A single line of input consists of a string, encryptedMessage. ✓ 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 Sample Input For Custom Testing a3b4q21 abcd2 abc Sample Output abc abcdd aaabbbbqqi Info Java 8 ✔ Autocomplete Ready Ⓒ
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education