#C523. Score Calculation Based on Problem Types and Submission Results

    ID: 48856 Type: Default 1000ms 256MiB

Score Calculation Based on Problem Types and Submission Results

Score Calculation Based on Problem Types and Submission Results

You are given two strings S and T of equal length. The string S represents the type for each problem, where 'E' denotes an easy problem and 'H' denotes a hard problem. The string T represents the result of your attempt for each problem, where 'C' stands for correct and 'I' stands for incorrect.

Your task is to compute the total score. For each problem i:

  • If T[i] is 'C' (correct) and S[i] is 'E', add 1 point.
  • If T[i] is 'C' (correct) and S[i] is 'H', add 2 points.
  • No points are awarded for an incorrect submission.

If the input strings are empty, the score is 0.

The scoring function can be mathematically represented using the following formula:

\(score = \sum_{i=1}^{n} \left[\mathbf{1}_{\{T[i]=='C'\}} \times \left(\mathbf{1}_{\{S[i]=='E'\}} + 2\times\mathbf{1}_{\{S[i]=='H'\}}\right)\right]\)

inputFormat

The input consists of two lines:

  1. The first line is the string S representing the problem types.
  2. The second line is the string T representing the correctness of submissions.

outputFormat

Output a single integer which is the total score computed based on the rules described above.

## sample
EHEHHE
CCICIC
6