Sunday, 24 January 2021

coded decoded

import java.io.*;
class code
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("entre the code");
        String c=br.readLine();
        int l=c.length();
        String b="";String e="";
        for(int i=l-1;i>=0;i--)
        {
            b=b+c.charAt(i);
        }
        String d="";
        int a=0;
        int dd=0;
        
        while(a<l-1)
        {
            d=b.substring(a,a+2);
            dd=Integer.parseInt(d);
            if(dd==32||(dd>=65&&dd<=90)||(dd>=97&&dd<=99))
            {
                e=e+(char)dd;
                a=a+2;
            }
             else
             {
                 
                d=b.substring(a,a+3);
                dd=Integer.parseInt(d);
               if(dd>99&&dd<=122)
                 {
                    e=e+(char)dd;
                    a=a+3;
            
                }
                
                  }}System.out.println("decoded messege ="+e);
        
    
}}

No comments:

Post a Comment

HAY THAKYOU FOE VISIT

Program(python):-Find duplicates in an array (Geeks for geek problem)

QUESTION:- Given an array  a  of size  N  which contains elements from  0  to  N-1 , you need to find all the elements occurring more than o...