/**
 * Created by xXxCKxXx on 11/6/2016.
 */
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Hashtable;

public class Main {
    public static void main(String [] args) throws FileNotFoundException, IOException{
        File f = new File(args[0]);
        BufferedReader read = new BufferedReader(new FileReader(f));

        String line;

        while ((line = read.readLine()) != null && !(line = line.trim()).equals("")){
            ArrayList<String> array = new ArrayList<String>();
            ArrayList<String> uniqueChars = new ArrayList<String>();

            //create a valid String array out of the elements of the String
            for (int i = 0; i < line.length(); i++){
                if(validChar(line.valueOf(line.charAt(i)).toLowerCase()))
                    array.add(line.valueOf(line.charAt(i)).toLowerCase());
            }

            //create hash table to keep track of String elements
            Hashtable<String, Integer> charTable = new Hashtable<String, Integer>();

            //populate the table
            for (int i = 0; i < array.size(); i++){
                if(charTable.containsKey(array.get(i)))
                    charTable.put(array.get(i), charTable.get(array.get(i)) + 1);
                else
                    charTable.put(array.get(i), 1);
            }

            //create a list of unique characters
            for (int i = 0; i < array.size(); i++){
                if(!uniqueChars.contains(array.get(i))) {
                    uniqueChars.add(array.get(i));
                }
            }

            //create a list and fill the list
            int [] powers = new int [uniqueChars.size()];
            for (int i = 0; i < uniqueChars.size(); i++){
                powers[i] = charTable.get(uniqueChars.get(i));
            }

            //sort the numbers in the list in ascending order
            Arrays.sort(powers);

            //Iterate the table accumulating the value for the beautiful string
            int answer = 0;
            int count = 26;
            for (int i = powers.length-1; i > -1; i--){
                answer += count*powers[i];
                count--;
            }

            //print the answer
            System.out.println(answer);
        }
    }

    private static boolean validChar(String s) {
        String [] validChars = {"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"};
        for(int i = 0; i < validChars.length; i++){
            if(s.equalsIgnoreCase(validChars[i]))
                return true;
        }
        return false;
    }
}