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

20082번 - Laugh 서브태스크다국어언어 제한함수 구현

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB142634740.171%

문제

Russian scientists are working on several promising topics. One of them is the quality of laugh. In this research they analyse the human speech and extract the laugh from it.

The scientists already made the software which converts speech to text. They consider a string of alternating letters “h” and “a” to be a laugh. For example, strings “ahahaha”, “hah” and “a” are laughs, but “abacaba” and “hh” are not.

You are given a string s containing the text. Find the length of the longest substring which is considered a laugh.

구현

You should implement the following function (method):

  • int longest_laugh(string s). This function should return the length of the longest substring of s which is considered a laugh.

Please use the provided template files for details of implementation in your programming language.

입력

출력

제한

예제 1

  • s = “ahaha

The whole string is a laugh, so the answer is 5.

예제 2

  • s = “ahahrunawayahahsofasthah

The longest substring is “ahah”, so the answer is 4.

예제 3

  • s = “ahahaahaha

The longest substring is “ahaha”, so the answer is 5.

서브태스크

번호배점제한
121

|s| ≤ 20

226

|s| ≤ 5000

353

|s| ≤ 105

힌트

샘플 그레이더

The sample grader reads the input in the following format:

  • line 1: string s.

출처

Olympiad > International Olympiad in Informatics > IOI 2016 > Practice 1번

제출할 수 있는 언어

C++17, C++14, C++20, C++14 (Clang), C++17 (Clang), C++20 (Clang)

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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