Page 367 - Computer science 868 Class 12
P. 367

34              for(i=0;i< len1;i++)
                   35              {

                   36                  for(j=0;j< x;j++)
                   37                  {

                   38                      if(i==a[j])
                   39                          break;

                   40                  }
                   41                  if(j==x)
                   42                      s3=s3+s1.charAt(i);

                   43              }

                   44              for(i=0;i< len2;i++)
                   45              {
                   46                  for(j=0;j< y;j++)

                   47                  {
                   48                      if(i==b[j])

                   49                          break;
                   50                  }

                   51                  if(j==y)
                   52                      s4=s4+s2.charAt(i);

                   53              }
                   54              System.out.println("Original string1="+s1+" Modified string1="+s3);

                   55              System.out.println("Original string2="+s2+" Modified string2="+s4);
                   56          }

                   57      }

                 The output of the preceding program is as follows:
                 Enter the first sentence:
                 India is great

                 Enter the second sentence:
                 India is my country
                 Original string1=India is great
                 Modified string1=ge
                 Original string2=India is my country
                 Modified string2=i my couny









                                                                                                                       365
                                                                                                              Strings  365
   362   363   364   365   366   367   368   369   370   371   372