Page 431 - CA_Blue( J )_Class10
P. 431
22 else
23 {
24 if(wd.equalsIgnoreCase(revwd))
25 {
26 System.out.println(wd);
27 }
28 wd="";
29 revwd="";
30 }
31 }
32 }
33 }
To input a sentence and create a new sentence after encoding the sentence in the following
Program 7
format. If the character is a vowel, then replace it with the next character else the character is
same.
Input : INDIA IS MY COUNTRY
Output : JNDJB JS MY CPVNTRY
1 import java.util.*;
2 class encode
3 {
4 public static void main()
5 {
6 Scanner sc= new Scanner(System.in);
7 String str, wd="" , encodestr="";
8 int i, l;
9 char ch;
10 System.out.print("Enter a sentence: ");
11 str=sc.nextLine();
12 str= str+ " " ;
13 str=str.toUpperCase();
14 l=str.length();
15 for(i=0;i<l;i++)
16 {
17 ch=str.charAt(i);
18 if(ch!=' ')
429
String Handling 429

