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

5990번 - Barn Echoes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB15711110278.462%

문제

The cows enjoy mooing at the barn because their moos echo back, although sometimes not completely. Bessie, ever the excellent secretary, has been recording the exact wording of the moo as it goes out and returns. She is curious as to just how much overlap there is.

Given two lines of input (letters from the set a..z, total length in the range 1..80), each of which has the wording of a moo on it, determine the greatest number of characters of overlap between one string and the other. A string is an overlap between two other strings if it is a prefix of one string and a suffix of the other string.

By way of example, consider two moos:

 moyooyoxyzooo
 yzoooqyasdfljkamo

The last part of the first string overlaps 'yzooo' with the first part of the second string. The last part of the second string overlaps 'mo' with the first part of the first string. The largest overlap is 'yzooo' whose length is 5.

입력

  • Lines 1..2: Each line has the text of a moo or its echo

출력

  • Line 1: A single line with a single integer that is the length of the longest overlap between the front of one string and end of the other.

제한

예제 입력 1

abcxxxxabcxabcd
abcdxabcxxxxabcx

예제 출력 1

11

힌트

'abcxxxxabcx' is a prefix of the first string and a suffix of the second string.

출처

Olympiad > USA Computing Olympiad > 2009-2010 Season > USACO October 2009 Contest > Gold 3번

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

출처

대학교 대회

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

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