Shifting and Rotating Letters 

Solution Ammended:

Apologies to all but the solution I sent with the last Problem of the Week was a solution to an earlier version of the problem where the player was given a certain number of points to complete the task.  At the end of that program, the player was to print "yes" if it was possible to make the transformation with the given points and "no" if it was not.  I felt that adding this extra feature was just extra work that didn't really test anything new so I removed it and had the player just print the lowest number of points needed.

This is the updated solution.

 

Solution (JAVA):

=======================================

import java.util.Scanner;
public class Main {
    
    public static int letterDifference(char letter1, char letter2)
    {
        int difference = Math.abs(letter1-letter2);
        if(difference > 13)
            difference = 26 - difference;
        
        return difference;
    }
    
    public static void main (String[] args)
    {
        Scanner input = new Scanner(System.in);
        
        String word1 = input.next();
        String word2 = input.next();
        
        char[] original = word1.toCharArray();
        char[] target = word2.toCharArray();
        
        int rotations = 0;
        int lowestPoints = 1000000;
        
        
        //letterDifference(original[0], target[0]);
        
        for(int shifts = 0; shifts < original.length; shifts++)
        {
            
            int difference = 0;
            for(int x = 0; x < original.length; x++)
                difference += letterDifference(original[x], target[x]);
            
            int multiplier = (rotations > (original.length / 2)? original.length - rotations:rotations);
            
            int pointsThisTime = difference + original.length*multiplier;
            
            if(pointsThisTime < lowestPoints)
                lowestPoints = pointsThisTime;
        
            /*
            //TEST CODE
            System.out.println(original);
            System.out.println("Rotation: " + rotations);
            System.out.println("Lowest Points: " + lowestPoints);
            System.out.println("Points this time:" + (difference + multiplier*original.length));
            System.out.println();
            */
            
            word1 = word1.substring(1) + word1.charAt(0);
            original = word1.toCharArray();
            rotations++;
        }
        
        System.out.println(lowestPoints);
        
    }  
}