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

18744번 - Cat 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB67282139.623%

문제

How many distinct strings can be obtained by concatenating a non-empty suffix of string a with a non-empty prefix of string b?

입력

The first line contains a single integer t (1 ≤ t ≤ 105), denoting the number of test cases.

Each test case is described with strings a and b on separate lines. Both strings consist of lowercase English letters and have length between 1 and 105, inclusive.

The total length of strings over all test cases does not exceed 2 · 105.

출력

For each test case, display the required number.

제한

예제 입력 1

5
abb
bba
aaa
aaaaa
winter
camp
ehehe
heheh
aaaaaaabaaaa
aabaaaaaa

예제 출력 1

8
7
24
16
97

힌트

In the first test case, all obtainable strings are abbb, abbbb, abbbba, bb, bbb, bbba, bbbb, bbbba.

In the second test case, only strings consisting of at least 2 and at most 8 letters a can be obtained.

출처

Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 7: Gennady Korotkevich Contest 5 C번

Contest > Open Cup > 2019/2020 Season > Stage 11: Grand Prix of Gomel C번

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

출처

대학교 대회

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

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