[백준]1343번: 폴리오미노

yewon Lee·2023년 4월 30일
0


😎BACKJOON>1343번: 폴리오미노


📘 문제풀이

  1. "XXXX" -> "AAAA"
  2. "XX" -> "BB"
  3. 변경되지 않은 문자가 있다면 -1 출력
str = input()

str = str.replace('XXXX', 'AAAA')
str = str.replace('XX', 'BB')

if 'X' in str:
    print(-1)
else:
    print(str)
replace를 사용할 때 다시 넣어주어야 변경된다.
text = text.replace(old_text, new_text, replace_count)
profile
시작

0개의 댓글