DECODE the messages from OPC ACUMEN 2015

I am getting correct output for its sample input but yet it is showing wrong answer. I am unable to find bug on my code. here it is :
import java.io.;
import java.util.
;
class decode123
{
public void concat(String a,String b,String o,String m,String n,String p,String b2)
{
String str1=“”,str2=“”,str3=“”,str4=“”,str5=“”;
str1=str1+a+o+m+p;
str2=str2+a+o+n+p;
str3=str3+b+o+m+p;
str4=str4+b+o+n+p;
str5=str5+b2;
System.out.println(str1.trim()+“\n”+str2.trim()+“\n”+str3.trim()+“\n”+str4.trim()+“\n”+str5.trim());
}
public void processing(String str)
{
String a=“”,b=“”,o=“”,m=“”,n=“”,p=“”,b2=“”;
int i=2,j,k,l,d,z,v;
if(str.length()==1)
{
System.out.println(str);
}
else
{
do
{
a=a+str.charAt(i);
i++;
j=i;
}
while(str.charAt(i)!=‘,’);
j=j+1;
do
{
b=b+str.charAt(j);
j++;
k=j;
}
while(str.charAt(j)!=‘)’);
k=k+1;
do
{
o=o+str.charAt(k);
k++;
l=k;
}
while(str.charAt(k)!=‘(’);
l=l+1;
do
{
m=m+str.charAt(l);
l++;
d=l;
}
while(str.charAt(l)!=‘,’);
d=d+1;
do
{
n=n+str.charAt(d);
d++;
z=d;
}
while(str.charAt(d)!=‘)’);
z=z+1;
do
{
p=p+str.charAt(z);
z++;
v=z;
}
while(str.charAt(z)!=‘,’);
v=v+1;
do
{
b2=b2+str.charAt(v);
v++;
}
while(str.charAt(v)!=‘)’);
concat(a,b,o,m,n,p,b2);
}
}
public static void main(String args[])throws Exception
{
decode123 ob = new decode123();
String str;
int t;
try
{
Scanner console = new Scanner(System.in);
t=console.nextInt();
for(int i=1;i<=t;i++)
{
str=console.nextLine();
if(str.length()<=1000&&str.length()>=1)
{
ob.processing(str);
}}
}
catch (Exception e)
{
}
}
}

thanks,
deep

1 Like