NPTEL PROGRAMMING ASSIGNMENTS
The Joy of Computing using Python
Week 11: Programming Assignment 1 - Sorting of Words
Due on 2021-10-14, 23:59 ISTWrite a program to read a comma-separated set of words as input and print the words in a comma-separated sequence after sorting them alphabetically.
Input Format be like
The first line of input contains words separated by a comma.
Output Format must be like
Print the sorted words separated by comma.
For Example:
If Input is
programming,hello,big,world
Then Output must be
big,hello,programming,world
Write a program to read a comma-separated set of words as input and print the words in a comma-separated sequence after sorting them alphabetically.
Input Format be like
The first line of input contains words separated by a comma.
Output Format must be like
Print the sorted words separated by comma.
For Example:
If Input is
programming,hello,big,world
Then Output must be
big,hello,programming,world
Week 11: Programming Assignment 2 - Puncutations
Due on 2021-10-14, 23:59 ISTGiven a string, remove all the punctuations in it and print the remaining characters.
Input Format is
The first line of the input contains a string with punctuations.
Then Output Format must be
Display the string after removing the punctuations
For Example:
If Input is
“Wow!!! It’s a beautiful morning”
Then Output must be
Wow Its a beautiful morning
Given a string, remove all the punctuations in it and print the remaining characters.
Input Format is
The first line of the input contains a string with punctuations.
Then Output Format must be
Display the string after removing the punctuations
For Example:
If Input is
“Wow!!! It’s a beautiful morning”
Then Output must be
Wow Its a beautiful morning
Week 11: Programming Assignment 3 - Solve the riddle
Due on 2021-10-14, 23:59 ISTYou are given a set of riddles. Each riddle will be in the form of a long string of jumbled alphabets (all the alphabets will be lowercase). As an answer to the riddle, you have to tell the length of the longest possible palindrome that can be formed from the given alphabet sequence. Note that the alphabets can be arranged in any sequence to form the palindrome.
Input Format be like
The first line contains an integer t indicating the number of test cases
Next t test cases follow
The single line of each test case contains a string of lowercase alphabets
1 ≤ t ≤ 100
1 ≤ Input String Length ≤ 1000
Output Format be Like
For each test case, output the length of the largest possible palindrome that can be formed using the given string.
For Example the
Input is
2
banana
abccdebbaa
And Output must be
5
7
Explanation:
If riddle is abccdebbaa,
The maximum length of the palindrome that can be formed is 7
(One such possible palindrome is cabbbac)
You are given a set of riddles. Each riddle will be in the form of a long string of jumbled alphabets (all the alphabets will be lowercase). As an answer to the riddle, you have to tell the length of the longest possible palindrome that can be formed from the given alphabet sequence. Note that the alphabets can be arranged in any sequence to form the palindrome.
Input Format be like
The first line contains an integer t indicating the number of test cases
Next t test cases follow
The single line of each test case contains a string of lowercase alphabets
1 ≤ t ≤ 100
1 ≤ Input String Length ≤ 1000
Output Format be Like
For each test case, output the length of the largest possible palindrome that can be formed using the given string.
For Example the
Input is
2
banana
abccdebbaa
And Output must be
5
7
Explanation:
If riddle is abccdebbaa,
The maximum length of the palindrome that can be formed is 7
(One such possible palindrome is cabbbac)