1
Output(decoded text): James Bond
Input(encoded text) : 784873674210132323212006589
Output(decoded text) : Nice Day
How to get the desired output ??
3 answers
1
Ruchi, the message is coded by first converting it to the opposite case and then getting its ASCII code. To decode the string you should start by first converting the given ASCII code to it's equivalent character and then converting it to its opposite case. Give it a try and if it doesn't work, paste your code here. We'll help you with this.
0
0
import java.util.*;
class decription
{
void display()
{
Scanner sc=new Scanner (System.in);
System.out.println("Enters encrypted data");
String s=sc.nextLine();
String s2="";
int b=0;
for(int i=0;i<s.length();i++)
{
String s1=s.substring(b,i+1);
int a=Integer.parseInt(s1);
if((a>=65 && a<=90) || (a>=97 && a<=122) || (a==32) )
{
s2=s2+(char)a;
b=i+1;
}
else
{
continue;
}
}
System.out.println(s2);
}
}
Log in to your account to answer this questions.