import java.io.*;
public class ColumnTransSender
{
String
columns1[]={"","","","",""};
public
static void main(String s[])
{
String
columns[]={"","","","",""};
String
key="21403";
String
msg = "My name is Shreyansh";
String
result = "";
int
i;
for(i
= 0; i < msg.length(); i++)
columns[i % key.length()] += msg.charAt(i);
for(i=i%key.length();i<key.length();i++)
columns[i]
+= "a";
for(i
= 0; i < key.length(); i++)
System.out.println("Data
is : " + columns[i]);
for(i
= 0; i < key.length(); i++)
{
result
+= columns[Integer.parseInt(""+key.charAt(i))];
}
System.out.println("Data
in Result : " + result);
ColumnTransSender
d = new ColumnTransSender();
d.decrypt(result,key);
}
public
void decrypt(String result,String key)
{ int i=0;
for(int
j = 0; j<key.length();j++,i+=Integer.parseInt(""+result.length()/key.length()))
{
columns1[Integer.parseInt(""+key.charAt(j))]
+=
result.substring(i,i+Integer.parseInt(""+result.length()/key.length()));
}
for(
i = 0; i < columns1.length; i++)
System.out.println("Data
in again : " + columns1[i]);
}
}