Cryptophasia is a language that is created and spoken between twins before they learn their own mother tongue. Since no one knows that language, it still remains a secret. As humans never left a stone unturned, Scientists have found that this language is created, just by mispronouncing the existing language that we all know. Doesn’t this remind you about encryption? Yes, it’s quite similar. All we need to do is, change a few grammatical rules of a particular language so that the reader should know these rules in order to decrypt them.
As we all know, we could still read a misspelled word correctly, if their first and last alphabets are right. So, this explains the importance of the first and the last alphabets in a word in reading it properly. Cryptophasia wisely uses this technique, to encrypt a word. It changes the first and the last alphabets of a word and encrypts it. Now let’s see the rules that are been followed to achieve this state, so that no one can decrypt these words, except those who know these rules.
- Remove the first alphabet of the word. See the below example
apple --> pple
- Append this first alphabet to the end of the word.
pple --> pplea
- Append the string ‘ay’ to the end of the word.
pplea --> ppleaay
The word ‘apple’ has been encrypted into ‘ppleaay’. In this way, any word can be encrypted into an unknown form, making it difficult for the reader to understand it.
Before coding, we should be aware that the input can be of any form. They may contain uppercase and lowercase alphabets, special characters, spaces, and numbers. In order to encrypt it efficiently, we won’t be using uppercase alphabets and special characters. Because when these uppercase and special characters are present in the word, it can even provide a clue to the reader about the word.
A few cases can be as follows:
- Uppercases mostly occur at the start of the word. This can give them a clue about the starting alphabet.
- Some special characters are specifically used in a few formats only like @ in E-Mail IDs, + in phone numbers, etc.
This makes us realize that it’s really needed to:
- Convert uppercase into lowercase alphabets.
- Remove special characters.
Since strings are immutable, it is quite difficult to make changes in a given word. So, it’s highly essential to convert the string into a list that is mutable. In our program, since we are playing with alphabets of a word, splitting the alphabets of the word as well into a list plays an important role.
Below is the implementation.
ppleAay eeksforGeeksGay appyhay
- Reusable piece of python functionality for wrapping arbitrary blocks of code : Python Context Managers
- Code Golfing in Python
- Issues with using C code in Python | Set 2
- Code introspection in Python
- code.compile_command() in Python
- Python code to convert SOP to POS
- Issues with using C code in Python | Set 1
- Top 10 Python IDE and Code Editors in 2020
- Different Python IDEs and Code Editors
- How to clone a method code in Python?
- Execute a String of Code in Python
- How to run Python code on Google Colaboratory
- Python code formatting using Black
- Packaging and Publishing Python code
- Morse Code Translator In Python
- Debugging Python code using breakpoint() and pdb
- Hamming Code implementation in Python
- Optimization Tips for Python Code
- Change your way to put logic in your code - Python
- Python - Morse Code Translator GUI using Tkinter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.