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

25845번 - Hidden Message 다국어

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

문제

John was reading the local newspaper, and noticed that the phrase “chime a cork teen” could be split into three sub-phrases “eat”, “more”, and “chicken”. Note that the three sub-phrases combined contain exactly the same letters as the original phrase and the letters in each sub-phrase appear in the same order as they appear in the original phrase. Note also that the number of occurrences of each letter in the three sub-phrases combined is the same as that of the original phrase.

John began to theorize that the newspapers were sending him messages, but you decide to show him that a message like that was not abnormal. You want to determine the number of ways a phrase can be broken down into three words that John finds.

Given three sub-phrases and the original phrase, determine the number of ways the sub-phrases can be formed from the original phrase. The number of ways can be quite large, so determine the number modulo 1,000,000,007.

입력

The input consists of four lines. Each of the first three input lines contains 1-100 lowercase letters, representing a sub-phrase. The fourth input line contains 3-300 lowercase letters, representing the original phrase. Note that the sum of the lengths of the three sub-phrases is equal to the length of the original phrase.

출력

Print a single integer representing the number of ways to partition the original phrase into three groups where each group is one of the three sub-phrases. Print the count modulo 1,000,000,007.

제한

예제 입력 1

eat
more
chicken
chimeacorkteen

예제 출력 1

2

예제 입력 2

the
great
depression
depressigortheneat

예제 출력 2

2

예제 입력 3

a
a
a
aaa

예제 출력 3

6

힌트

출처

University > University of Central Florida > 2020 Local Programming Contest (Round 1B) 6번

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

출처

대학교 대회

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

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