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

26581번 - Repeat 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB47312367.647%

문제

Your teacher has been marking students off on their essays for repeating words and phrases when they could be exploring new syntax and using a thesaurus to spice up their writing. In order to save yourself from being called out for using repeats, you decide to create a way to check your essay for repeated substrings and find the longest one to fix. Write a program that, given a string of characters, finds the greatest repeated substring with no overlapping characters.

입력

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will consist of one line with a string of letters of unknown length.

출력

Output the integer length of the longest repeated substring, a space, and then the repeated string. If there are multiple with the same length, print out the first one to appear in the string.

제한

예제 입력 1

2
thequickbrownfoxjumpedoverthelazydog
ratsarejustlikebigmicebutratsarecompletelydifferentanimals

예제 출력 1

3 the
7 ratsare

힌트

출처

School > PLU High School Programming Contest > PLU 2020 > Novice 9번

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

출처

대학교 대회

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

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