i need help on assignment 3 chatbot for computer science
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
The input will be a single line containing a string.
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
Sample Input
I am 5 years and 11 months old
Sample Output
I am 11 years and 5 months old
Given a square matrix, print the sum all diagonal elements of the matrix.
The first line of input will be an integer N, denoting the no. of rows in the matrix. The following N lines will contain space-separated integers denoting the elements of each row of the matrix.
The output should be a single integer denoting the sum of all the diagonal elements.
For example, if the given N is 3, and the given matrix is
1 2 3
4 5 6
7 8 9
The diagonal and anti-diagonal elements of the above matrix are 1, 3, 5, 7, 9. So the output should be 25
Rearrange numbers in string
given a string, write a program to re-arrange all the numbers appearing on the string in decreasing order.
Note: There will not be any negative numbers or numbers with decimal part
Vowel Sound
Given a sentence, write a program rotate all the words left, so that every word starts with a vowel.
Note: If there is no vowel in the word, do not rotate it.
The input will be a single line containing a string.
The output should be a single line containing the modified sentence with rotated words.
For example, if the given string is "I saw a DRAGON flying in the sky", rotating each word towards left in this way "I aws a AGONDR and ingfly in eth sky", makes every word start with a vowel letter. The word "sky" is not rotated as it does not have any vowel in it. The words "I", "a", "and", "in" are not rotated as they already start with a vowel.
Sample Input
I saw a DRAGON flying in the sky
Sample Output
I aws a AGONDR ingfly in eth sky
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
The input will be a single line containing a string.
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
Sample Input
I am 5 years and 11 months old
Sample Output
I am 11 years and 5 months old
Matrix Diagonal Sum
Given a square matrix, print the sum all diagonal elements of the matrix.
The first line of input will be an integer N, denoting the no. of rows in the matrix. The following N lines will contain space-separated integers denoting the elements of each row of the matrix.
The output should be a single integer denoting the sum of all the diagonal elements.
For example, if the given N is 3, and the given matrix is
1 2 3
4 5 6
7 8 9
The diagonal and anti-diagonal elements of the above matrix are 1, 3, 5, 7, 9. So the output should be 25
Sample Input
3
1 2 3
4 5 6
7 8 9
Sample Output
25
Given a square matrix, print the sum all diagonal elements of the matrix.
Rearrange Numbers in String
Given a string, write a program to re-arrange all the numbers appearing in the string in decreasing order. Note: There will not be any negative numbers or numbers with decimal part.
Input
The input will be a single line containing a string.
Output
The output should be a single line containing the modified string with all the numbers in string re-ordered in decreasing order.
Explanation
For example, if the given string is "I am 5 years and 11 months old", the numbers are 5, 11. Your code should print the sentence after re-ordering the numbers as "I am 11 years and 5 months old".
Sample Input
I am 5 years and 11 months old
Sample Output
I am 11 years and 5 months old
Vowel Sound
Given a sentence, write a program rotate all the words left, so that every word starts with a vowel.
Note: If there is no vowel in the word, do not rotate it.
Input
The input will be a single line containing a string.
Output
The output should be a single line containing the modified sentence with rotated words.
Explanation
For example, if the given string is "I saw a DRAGON flying in the sky", rotating each word towards left in this way "I aws a AGONDR and ingfly in eth sky", makes every word start with a vowel letter. The word "sky" is not rotated as it does not have any vowel in it. The words "I", "a", "and", "in" are not rotated as they already start with a vowel.
Sample Input
I saw a DRAGON flying in the sky
Sample Output
I aws a AGONDR ingfly in eth sky