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 27 28
|
import java.util.Scanner;
public class Divers5
{
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'};
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++)
{
char c=n.charAt(i);
for(int j=0;j<26;j++)
{
if(c==first[j])
{
int pos1=j;
System.out.print(second[pos1]);
}
}
}
}
} |
Partager