import java.util.Scanner;
import java.util.ArrayList;
import java.io.File;

public class Problem_1_Word_Frame {

    public static void main(String[] args) {
        
        try {
            Scanner scanner = new Scanner(new File("C:\\Users\\Mike\\Desktop\\problem_1_word_frame_DATA11.txt"));
            ArrayList<String> list = new ArrayList<String>();
            
            // read in the file to the ArrayList
            while (scanner.hasNextLine()) {
                list.add(scanner.nextLine());
            }
                        
            for (String word : list) {
                
                // print first line
                System.out.print("* ");
                for (int i = 0; i < word.length(); i++) {
                    System.out.print(word.charAt(i) + " ");
                }
                System.out.println("*");
                
                // print middle content
                for (int i = 0; i < word.length(); i++) {
                    System.out.println(word.charAt(word.length() - 1- i) + stars(word.length()) + word.charAt(i));
                }

                // print last line
                System.out.print("* ");
                for (int i = word.length() - 1; i > -1; i--) {
                    System.out.print(word.charAt(i) + " ");
                }
                System.out.println("*\n");
            }

        } catch (Exception e) {
            System.out.println("Exception");
        }
        
    }
    
    /* returns a string with n number of stars */ 
    public static String stars(int n) {
        
        String s = " ";
        for (int i = 0; i < n; i++) {
            s += "* ";
        }
        return s;
    }
}