- "XXXX" -> "AAAA"
- "XX" -> "BB"
- 변경되지 않은 문자가 있다면 -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)