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

33237번 - Icarus' Rebirth 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB40211548.387%

문제

In an attempt to escape from Crete's highest tower, where they were imprisoned, Icarus and his father Daedalus made two pairs of wings, with which they could fly away to Athens. During their flight, all was well until Icarus' hubris led him to fly too close to the sun, causing his wings to melt and him to drown in the Mediterranean Sea. Mourning the loss of his child, Daedalus now undertakes a perilous journey through the underworld to find Hades -- the god of the dead. He meets Hades and begs him to give back his son.

"Your request shall be granted, craftsman, but only if you prove yourself worthy by solving this task," says Hades. "I shall give you a word in the language of the gods. You see, the way we gods measure a word's length is different from the method you humans use. We measure the length of a word by calculating the minimum number of steps that need to be taken from the first character, to reach the last one. In a step, starting from the character with value $x$ at position $i,ドル you may either go to a character with position $i-1$ or $i+1,ドル or you can go to the closest character with value $x$ to the left or to the right." Daedalus is a smart man, and knowing he can not solve this problem for enormous words, he asks you to write a computer program that calculates the length of any word on your magical stone tablet.

Given some word in the language of the gods, calculate its length according to the gods' way of measuring, so Daedalus can take back his beloved son Icarus.

입력

The input consists of:

  • A line with a single word $w$ (1ドル\leq |w|\leq 10^5$). The word contains only lowercase letters from the English alphabet ('a-z').

출력

Output a single number, the length of the word $w,ドル according to the gods' way of measuring.

제한

예제 입력 1

word

예제 출력 1

3

예제 입력 2

adiacrac

예제 출력 2

3

힌트

출처

University > Delft University of Technology > Freshmen Programming Contest 2021 I번

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

출처

대학교 대회

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

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