RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0453

Uddered but not Herd

Platinum III 플래티넘 III
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

A little known fact about cows is that they have their own version of the
alphabet, the "cowphabet". It consists of the 26 letters 'a' through 'z', but
when a cow speaks the cowphabet, she lists these letters in a specific ordering
that might be different from the order 'abcdefghijklmnopqrstuvwxyz' we are used
to hearing.

To pass the time, Bessie's cousin Mildred has been humming the cowphabet over
and over again, and Farmer Nhoj is curious how many times she's hummed it.

Given a lowercase string of letters that Farmer Nhoj has heard Mildred say,
compute the minimum number of times Mildred must have hummed the entire
cowphabet in order for Farmer Nhoj to have heard the given string. Farmer Nhoj
isn't always paying attention to what Mildred hums, and so he might have missed
some of the letters that Mildred has hummed. The string you are told consists of
just the letters that he remembers hearing.

Note: the time limit per test case on this problem is twice the default.

Problem credits: Nick Wu and Brian Dean

제약

SCORING

  • In test cases 1-5, Farmer Nhoj only heard letters that appear in Mildred's or Bessie's names.
  • In test cases 6-16, Farmer Nhoj never heard any of the letters that appear in Mildred's name.

Problem credits: Nick Wu and Brian Dean

입력 형식

The only line of input contains the string of lowercase letters that Farmer
Nhoj heard Mildred say. This string has length at least \(1\) and at most \(10^5\).

출력 형식

Print the minimum number of times Mildred must have hummed the entire cowphabet.

예제 1
입력
mildredree
출력
3
설명

Mildred must have hummed the cowphabet at least three times. It is possible for
Mildred to have only hummed the cowphabet three times if the cowphabet starts
with "mildre" and Farmer Nhoj heard the letters in uppercase as denoted below.

MILDREabcfghjknopqstuvwxyz
milDREabcfghjknopqstuvwxyz
mildrEabcfghjknopqstuvwxyz
문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2020-2021 > January > Gold

태그

평가 및 의견

Uddered but not Herd

개요
출제자 난이도 Platinum III 플래티넘 III 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Uddered but not Herd

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8