백준

백준 11008번: 복붙의 달인 (파이썬)

inns21 2023. 7. 28. 10:38

 

n = int(input())
for i in range(n):
  # s : 입력할 단어, p : 복붙한 단어
  s,p = input().split()
  
  # 복분한 단어가 몇 번 나오는지 count변수에 저장
  count = s.count(p)
  
  # count로 복붙한 단어를 계산했기 때문에 제거
  s = s.replace(p,'')
  
  # 결과 출력
  print(count + len(s))