Full molecular string (problem solution)

Time limit : 1.0s    Memory limit : 256.0MB

Problem Description

  Xiao Ming is particularly interested in strings recently. And did some research on strings.
  For the convenience of research, Xiao Ming corresponds each letter to an integer. He corresponds a to 1, b to 2, and so on, and z to 26.
  If the sum of the integers corresponding to all the characters in a string is 100, Xiao Ming calls the string a full-score string. If a substring of a string (that is, a string composed of a certain continuous segment of characters in the string) is a full-score string, it is called a full-score substring.
  Given a string, Xiao Ming wants to know how many substrings are full substrings.

input format

  Enter a line containing a string, which only contains lowercase English letters.

output format

  Output an integer indicating how many full substrings there are in the given string.

sample input

yyaxyyy

sample output

3

Sample description

  a corresponds to 1, x corresponds to 24, and y corresponds to 25.

Evaluation use case scale and agreement

        Let L denote the length of the input string.

        For  40%  of the evaluation cases, 1 ≤ L ≤ 100 ;

        For  70%  of the evaluation cases, 1 ≤ L ≤ 1000 ;

        For  100%  of the evaluation cases, 1 ≤ L ≤ 100000  .

Solution ( idea):

Guess you like

Origin blog.csdn.net/FlyFree56/article/details/130671279