public static void lookUpMovie(String str, int width) {
		char[] arr = str.toCharArray();
		
		int prevPosition = 0;
		int prevRow = 0;
		
		for(char c : arr) {
			// Tricks I learned from a solution on CareerCup.
			// Get the horizontal distance moved.
			int position =  (c - 'a') % width; 
			// Get the vertical distance moved.
			int row = (c - 'a') / width;
			
			// Print horizontal movement.
			int deltaHorizontal = position - prevPosition;
			if(deltaHorizontal != 0) {
				if(deltaHorizontal > 0)
					printCommand("r", deltaHorizontal);
				else if(deltaHorizontal < 0)
					printCommand("l", deltaHorizontal*-1);
				prevPosition = position;
			}
			
			// Print vertical movement.
			int deltaVertical = row - prevRow;
			if(deltaVertical != 0) {
				if(row - prevRow > 0)
					printCommand("d", deltaVertical);
				else if(row - prevRow < 0)
					printCommand("u", deltaVertical*-1);
				prevRow = row;
			}
			
			// Select after making the necessary movement.
			printCommand("!", 1);
		}
	}