그냥 counting
import sys
input = sys.stdin.readline
from collections import defaultdict
def count_chrs(s1, s2):
char_set = defaultdict(int)
for chr in s2:
char_set[chr] += 1
max_cnt = 0
for char in s1:
max_cnt = max(max_cnt,char_set[char])
return max_cnt
for test in range(1,int(input())+1):
str1 = input().rstrip()
str2 = input().rstrip()
print(f'#{test} {count_chrs(str1, str2)}')
'practivceAlgorithm > swexpertacademy' 카테고리의 다른 글
[SWEA][Python] 4864 문자열 비교 (0) | 2021.08.15 |
---|---|
[SWEA][Python] 4861 회문 (0) | 2021.08.15 |
[SWEA][Python] 1966 숫자를 정렬하자 (0) | 2021.08.12 |
[SWEA][Python] 1979 어디에 단어가 들어갈 수 있을까? (0) | 2021.08.12 |
[SWEA][Python] 2001 파리퇴치 (0) | 2021.08.12 |