Logo
(追記) (追記ここまで)

18479번 - Three Indices 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB155550.000%

문제

A string t is called a smooth transformation of a string w if there exist an integer m ≥ 1 and strings w0, w1, . . . , wm such that:

  • w0 = w, and |wi| = |w| when 0 < i ≤ m;
  • wi differs from wi−1 in at most one position when 0 < i ≤ m;
  • t = w0w1 . . . wm.

You are given a string s = s1s2 . . . s|s|. Find the number of triplets of indices (i, j, k) such that 1 ≤ i < j < k ≤ |s| and si..k = sisi+1 . . . sk is a smooth transformation of si..j = sisi+1 . . . sj.

입력

The only line of the input contains the string s (4 ≤ |s| ≤ 105) consisting of lowercase English letters.

출력

Display the sought number of triplets.

제한

예제 입력 1

abcababc

예제 출력 1

5

힌트

In the example test case, the triplets are (1, 3, 6), (3, 4, 6), (3, 4, 8), (4, 5, 7), and (5, 6, 8).

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 5: Gennady Korotkevich Contest 4 C번

Contest > Open Cup > 2018/2019 Season > Stage 11: Grand Prix of Gomel C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /