Given a string, the given string is an encrypted word, the task is to decrypt the given string to get the original word.
Input: str = "abcd" Output: bdee Explanation: a -> a + 1 -> b b -> b + 2 -> d c -> c + 2 -> e d -> d + 1 -> e Input: str = "xyz" Output: yaa Explanation: x -> x + 1 -> y y -> y + 2 -> a z -> z + 1 -> a
- Let the length of the string be n.
- then the encrypted string will be:
- Print the string after finding the scrypted word.
Below is the implementation of the above approach:
Time Complexity: O(N)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- C program to find and replace a word in a File by another given word
- Program to find Smallest and Largest Word in a String
- C program to Replace a word in a text by another given word
- Decrypt a string encrypted by repeating i-th character i times
- Program to replace a word with asterisks in a sentence
- Program for length of the longest word in a sentence
- Python program for word guessing game
- Java program to count the characters in each word in a given sentence
- Find the first repeated word in a string
- Find the word with most anagrams in a given sentence
- Longest Common Prefix using Word by Word Matching
- Find frequency of each word in a string in Python
- Find the first maximum length even word from a string
- Find shortest unique prefix for every word in a given list | Set 2 (Using Sorting)
- Find the count of sub-strings whose characters can be rearranged to form the given word
- Find largest word in dictionary by deleting some characters of given string
- Program to find sum of 1 + x/2! + x^2/3! +...+x^n/(n+1)!
- Program to find LCM of 2 numbers without using GCD
- Program to find the sum of the series 1 + x + x^2+ x^3+ .. + x^n
- Program to find the initials of a name.