Programming Challenge:
Given a string s, compute the sum, each letter is an integer between 1 and 26, inclusive, and no two letters have the same value. (Uppercase 'F' is exactly as as lowercase 'f', for example.)
You're a student writing a report on the youth of this famous hacker. You found the string that Johnny considered most beautiful. What is the maximum possible of this string?
Input:
Your program should read lines from standard input. Each line is a string.
Output:
Print out the maximum for the string.
Test 1
Test Input
ABbCcc
Expected Output
152
Test 2
Test Input
Ignore punctuation, please
Expected Output
491
I don't understand how they are getting the value for each letter. I originally thought if A = 1 and B = 1 then the sum would be 1 + 2 + 2 + 3 + 3 +3 but that is not 152. Then I thought maybe use the asc ii values of characters but then a and A would not be the same and either way it is much higher then 152.
So can anybody give me any hints about this problem??
Given a string s, compute the sum, each letter is an integer between 1 and 26, inclusive, and no two letters have the same value. (Uppercase 'F' is exactly as as lowercase 'f', for example.)
You're a student writing a report on the youth of this famous hacker. You found the string that Johnny considered most beautiful. What is the maximum possible of this string?
Input:
Your program should read lines from standard input. Each line is a string.
Output:
Print out the maximum for the string.
Test 1
Test Input
ABbCcc
Expected Output
152
Test 2
Test Input
Ignore punctuation, please
Expected Output
491
I don't understand how they are getting the value for each letter. I originally thought if A = 1 and B = 1 then the sum would be 1 + 2 + 2 + 3 + 3 +3 but that is not 152. Then I thought maybe use the asc ii values of characters but then a and A would not be the same and either way it is much higher then 152.
So can anybody give me any hints about this problem??