NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing using Python
Week 10 : Programming Assignment 1 - String Decomposition
Due on 2021-10-07, 23:59 ISTGiven a large string and a set of small strings, determine if it is possible to exactly
decompose the given large string into the set of small strings. (Assume that all the strings
are given in lowercase)Input Format be like
The first line of the input contains a large string
The second line of the input contains space separated small strings
Output Format must be like
Display Yes or No (no newline after the output)
For Example:
If Input is
abdefgbadklm
dab bad elmf kg
Then Output must be
Yes
or Input is
abdgefmnorst
frost badge lm
Then Output must be
No
Explanation:
In the first case it is possible to construct the set of small strings by using exactly all the characters given in the original string. In the second case it is not possible.
decompose the given large string into the set of small strings. (Assume that all the strings
are given in lowercase)
Input Format be like
The first line of the input contains a large string
The second line of the input contains space separated small strings
Output Format must be like
Display Yes or No (no newline after the output)
For Example:
If Input is
abdefgbadklm
dab bad elmf kg
Then Output must be
Yes
or Input is
abdgefmnorst
frost badge lm
Then Output must be
No
Explanation:
In the first case it is possible to construct the set of small strings by using exactly all the characters given in the original string. In the second case it is not possible.
Week 10 : Programming Assignment 2 - Encryption
Due on 2021-10-07, 23:59 ISTThe alphabets are enumerated as A = 0, B = 1, C = 2, … , Z = 25. Consider an encryption
scheme where a character with value C i in the plaintext is replaced by another character
with value C j using the formula C j = (C i + 5) % 26. After replacement, the resulting string is
shuffled (permuted) at random to obtain the cipher text.
Given a plain text and a possible cipher text, your task is to determine whether the cipher
text can be formed from the plain text using the above mentioned scheme.
(Assume that all the strings are in uppercase)Input Format is
The first line of the input contains a string indicating the plain text.
The second line of the input a string indicating a possible cipher text
Then Output Format must be
Display Yes or No (no newline after the output)
For Example:
If Input is
PYTHON
TDMSUY
Then Output must be
Yes
Or Input is
JOCPNPTEL
JQYVSUTHO
Then Output must be
No
scheme where a character with value C i in the plaintext is replaced by another character
with value C j using the formula C j = (C i + 5) % 26. After replacement, the resulting string is
shuffled (permuted) at random to obtain the cipher text.
Given a plain text and a possible cipher text, your task is to determine whether the cipher
text can be formed from the plain text using the above mentioned scheme.
(Assume that all the strings are in uppercase)
Input Format is
The first line of the input contains a string indicating the plain text.
The second line of the input a string indicating a possible cipher text
Then Output Format must be
Display Yes or No (no newline after the output)
For Example:
If Input is
PYTHON
TDMSUY
Then Output must be
Yes
Or Input is
JOCPNPTEL
JQYVSUTHO
Then Output must be
No
THANK YOU & WELCOME DUDE!
ReplyDelete