問題一覧 > 通常問題

No.1159 Sashiming String

レベル : / AI推定難易度 : 171 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 99
作問者 : 蜜蜂 / テスター : Mitarushi
お気に入りにしたユーザー ProblemId : 4957 / 自分の提出
問題文最終更新日: 2020-12-10 22:31:00
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original

Problem Statement

For an English-letter string $S$, we say that $S$ is a Sashiming string if the $1$st character of $S$ is an uppercase S and the last $3$ characters are ing.
For example, Snapping and String are Sashiming strings, but sashiming and SAMPLING are not Sashiming strings.
Given an English-letter string $S$, find the number of non-empty contiguous substrings of $S$ that are Sashiming strings.
Even if some of them are equal as strings, those with different starting positions are counted separately.

Input

$S $

$1 \leq |S| \leq 2 \times 10^5$
$S$ consists of uppercase and lowercase English letters.

Output

Output the answer on $1$ line.
Print a newline at the end.

Sample

Sample 1
Input
SingingSashiming
Output
4

Among the non-empty contiguous substrings of SingingSashiming, those that are Sashiming strings are the $4$ strings Sing, Singing, Sashiming, and SingingSashiming, so output $4$.

Sample 2
Input
SomethingISNOTSashiming
Output
4

Something and Sashiming are similar.

Source

Nada High School 75th Class Junior High Graduation Commemorative Contest: Sashiming String
writer: Sashiming
tester: Mitarushi
Ported in accordance with HackerRank's terms of service. Some parts have been modified.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。