Under construction

Still being built. Things may change

GPA Calculator

Time limit1sMemory limit512 MB

Summary
Given a string of concatenated letter grades such as A+ and B, print the arithmetic mean of their grade points.
Level

Easy2 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Jonghyun is building a program with Yeongdo that pulls data from the school portal and calculates Jonghyun's own grade points. Jonghyun wants to print the average grade point using the grade data Yeongdo extracted from the site.

The grade points for each grade follow this table.

GradePoints
A+4.5
A4.0
B+3.5
B3.0
C+2.5
C2.0
D+1.5
D1.0
F0.0

Input

The first line contains a string SS of the grades for each course. There are no separators between grades. The string consists only of characters from the table above, and its length is at most 1 0001\,000.

Output

Print the arithmetic mean of the grade points for the grades listed in SS on the first line. An answer is accepted if its absolute or relative error is at most 10−410^{-4}.

Examples3

  1. Example 1

    Input
    A+A
    
    Expected output
    4.25
    
  2. Example 2

    Input
    A+AB+B+C
    
    Expected output
    3.5
    
  3. Example 3

    Input
    CA+ABBB+A
    
    Expected output
    3.42857