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

20355번 - Caesar Word Salad 다국어

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

문제

The year is 46, B.C. Gaius Julius Caesar is the most powerful ruler in the world.

The newly named “imperator”, busy consolidating his power in Rome and waging wars abroad, needs a secure way to send messages to his representatives around the Roman world.

The now world-famous solution to this problem is the eponymous Caesar cipher, an encoding in which every letter from the plaintext is rotated through the alphabet by a fixed shift distance. For example, when encoded using a shift distance of 3, alexandra becomes dohadqgud.

Caesar is a master of strategy—he knows the value of an effective double-bluff and will not hesitate to use one. In fact, when possible, he will even send some messages with a shift distance of 0 to really confuse his enemies.

However, after a run in with the soothsayer Spurina, Caesar has become a worried man. He will hear no talk of any “i”s of March and so, wants to send only messages where the ciphertext contains no “i”s!

Given the plaintext of a message, how many distinct “i-free” shifts could be used for the encoding?

입력

The input consists of:

  • one line containing the plaintext w. w will be at least one character long and no more than 100 characters in length. It will contain only lower-case letters.

출력

If at least one “i-free” shift of w can be found, output the number of distinct shift distances that could be used.

Otherwise, output impossible.

You may consider 0 as a valid shift distance provided it does not lead to any “i”s.

제한

예제 입력 1

erratum

예제 출력 1

20

예제 입력 2

agricola

예제 출력 2

19

예제 입력 3

thequickbrownfoxjumpsoverthelazydog

예제 출력 3

impossible

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2016 연습 세션 PC번

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

출처

대학교 대회

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

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