Write a program that encodes a word into Piglatin. To translate word into a Piglatin word, convert the word into uppercase and then place the first vowel of the original word as the start of the new word along with the remaining alphabets. The alphabets present before the vowel being shifted towards the end followed by “AY”.
Input : London,
Output : ONDONLAY
Input : Olympics,
Output : OLYMPICSAY
Encryption is a technique of coding messages to maintain their secrecy. A String array of size ‘n’ where ‘n’ is greater than 1 and less than 10, stores single sentences (each sentence ends with a full stop) in each row of the array.
Write a program to accept the size of the array. Display an appropriate message if the size is not satisfying the given condition. Define a string array of the inputted size and fill it with sentences row-wise. Change the sentence of the odd rows with an encryption of two characters ahead of the original character. Also change the sentence of the even rows by storing the sentence in reverse order. Display the encrypted sentences as per the sample data given below:
Test your program on the sample data and some random data. Example 1 :
INPUT: n = 4
IT IS CLOUDY.
IT MAY RAIN.
THE WEATHER IS FINE. IT IS COOL.
OUTPUT: KV KU ENQWFA.
RAIN MAY IT.
VJG YGCVJGT KU HKPG. COOL IS IT.
Example 2 :
INPUT: n = 13
OUTPUT: INVALID ENTRY
Write a program to accept a sentence as input. The words in the string are to be separated by a blank. Each word must be in upper case. The sentence is terminated by either “.”,”!” or “?”. Perform the following tasks:
(i) Obtain the length of the sentence (measured in words).
(ii) Arrange the sentence in alphabetical order of the words.
INPUT: NECESSITY IS THE MOTHER OF INVENTION.
LENGTH : 6
REARRANGED SENTENCE : INVENTION IS MOTHER NECESSITY OF THE
INPUT: BE GOOD TO OTHERS.
LENGTH : 4
REARRANGED SENTENCE : BE GOOD OTHERS TO
Write a program to accept a sentence which may be terminated by either ‘.’ ‘?’ or ‘!’ only. Any other character may be ignored. The words may be separated by more than one blank space and are in UPPER CASE.
Perform the following tasks:
(a) Accept the sentence and reduce all the extra blank space between two words to a single blank space.
(b) Accept a word from the user which is part of the sentence along with its position number and delete the word and display the sentence.
Test your program with the sample data and some random data