import java.util.*;
public class RandomLetter {
static Random seed = new Random();
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
do {
System.out.print(" enter first name ");
String first = scanner.nextLine();
System.out.print(" enter last name ");
String last = scanner.nextLine();
System.out.printf("first = %s last = %s%n", first, last);
String alterFirst = alter(first);
String alterLast = alter(last);
System.out.printf("alterFirst = %s alterLast = %s%n",
alterFirst, alterLast);
System.out.println("\"x\" & enter to quit, else enter");
} while(!scanner.nextLine().trim().toLowerCase().equals("x"));
scanner.close();
}
private static String alter(String in) {
int index = seed.nextInt(in.length());
String letter = String.valueOf(in.charAt(index));
int end = in.length();
return letter + in.substring(0, index) + in.substring(index+1, end);
}
}