1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
import java.util.Scanner;
public class Testing5
{
public static void main(String[] args)
{
char first[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
//char second[]={'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a'};
char second[]={'h','y','l','u','j','p','v','r','e','a','k','b','n','d','o','f','s','q','z','c','w','m','g','i','t','x'};
Scanner sc = new Scanner(System.in);
System.out.println("Enter the name: ");
String n;
n=sc.nextLine();
int len=n.length();
for(int i=0;i<len;i++)
{
for(int j=0;j<26;j++)
{
char c=n.charAt(i);
if(c==first[j])
{
int pos1=j;
System.out.print(second[pos1]);
}
}
} |