Back
Close

Simple Hashing Algorithm

Statement

 Goal

Implement the following hashing algorithm:

Given any sequence of characters, sum the positions in the alphabet for all letters, where you multiply this position by 2 if the letter is uppercase.

Constrain the amount of digits in the hash to 6 by removing the last digits, or by adding zeros to the end.

Example:

Input:

Clash Of Code

Positions in the alphabet:

C: 3, l: 12, a: 1, s : 19, h: 8, O: 15, f: 6, C: 3, o: 15, d: 4, e: 5

C, O and C will be multiplied by 2, since they are uppercase.

The sum is: 3*2 + 12 + 1 + 19 + 8 + 15*2 + 6 + 3*2 + 15 + 4 + 5 = 112

112 has less than 6 digits, so the final hash is:

112000
Input
Line 1: A string sequence.
Output
Line 1: The result of the hashing algorithm applied on sequence.
Constraints
1 <= sequence.length <= 10000
Example
Input
Clash Of Code
Output
112000

Game modes
Fastest, Shortest

Test cases
Clash Of Code Test
Input
Clash Of Code
Output
112000

Validator 1 Validator
Input
Clash Of Code abc
Output
118000

Lorem ipsum - 100 Characters Test
Input
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l
Output
108300

Validator 2 Validator
Input
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut l def
Output
109800

Hamlet Test
Input
FRANCISCO at his post. Enter to him BERNARDO BERNARDO Who's there? FRANCISCO Nay, answer me: stand, and unfold yourself. BERNARDO Long live the king! FRANCISCO Bernardo? BERNARDO He. FRANCISCO You come most carefully upon your hour. BERNARDO 'Tis now struck twelve; get thee to bed, Francisco. FRANCISCO For this relief much thanks: 'tis bitter cold, And I am sick at heart. BERNARDO Have you had quiet guard? FRANCISCO Not a mouse stirring. BERNARDO Well, good night. If you do meet Horatio and Marcellus, The rivals of my watch, bid them make haste. FRANCISCO I think I hear them. Stand, ho! Who's there?
Output
687700

Validator 2 Validator
Input
FRANCISCO at his post. Enter to him BERNARDO BERNARDO Who's there? FRANCISCO Nay, answer me: stand, and unfold yourself. BERNARDO Long live the king! FRANCISCO Bernardo? BERNARDO He. FRANCISCO You come most carefully upon your hour. BERNARDO 'Tis now struck twelve; get thee to bed, Francisco. FRANCISCO For this relief much thanks: 'tis bitter cold, And I am sick at heart. BERNARDO Have you had quiet guard? FRANCISCO Not a mouse stirring. BERNARDO Well, good night. If you do meet Horatio and Marcellus, The rivals of my watch, bid them make ha ste. FRANCISCO I think I hear them. Stand, ho! Who's there? asddg
Output
691200

BBC Article Test
Input
Easyjet has started a consultation process with unions about making redundancies, in response to the collapse in air travel caused by the coronavirus pandemic. The British airline's proposals include closing three UK bases - London Stansted, London Southend and Newcastle - although the airports would remain on EasyJet’s route network. Pilots union BALPA says it is "shocked" at the scale of the job cuts, which it says equates to a third of EasyJet’s pilots in the UK - 727 pilots.
Output
496400

Validator 3 Validator
Input
Easyjet has started a consultation process with unions about making redundancies, in response to the collapse in air travel caused by the coronavirus pandemic. The British airline's proposals include closing three UK bases - London Stansted, London Southend and Newcastle - although the airports would remain on EasyJet’s route network. Pilots union BALPA says it is "shocked" at the scale of the job cuts, which it says equates to a third of EasyJet’s pilots in the UK - 727 pilots. 1asdfashdfasnd fjk
Output
509700

Solution language

Solution

Stub generator input