Words in Encrypted String
Start Timer
0:00:00
You are required to extract a specific word target_word
from an encrypted document. Fortunately, you have the basic information needed to decrypt that document.
The equation used to encrypt the document is as follows:
Where:
- is a letter
- is the number representing the position of the letter in the alphabet (1 for
A
, 2 forB
, etc.) - is an arbitrary integer.
- is the encrypted letter.
Return the number of occurrences of target_word
in the document after decryption.
Note: The document only has upper case letters and spaces.
Example:
Input:
encrypted_document = 'WKH TXLFN EURZQ IRA MXPSV RYHU WKH ODCB GRJ'
n = 3
target_word = 'BROWN'
Output:
extract_word(encrypted_document,n,target_word) -> 1
Explanation:
After decrypting the document, you will have :
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
In which the target_word
(BROWN) appears only once.
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments