DOJ logoDOJ
문제
최근 추가된 문제들저장한 문제
카테고리DLC대회그룹팀게시판
랭킹
문제 풀이 랭킹스트릭 랭킹DOJ Power 랭킹
현황
문제 제안로그인회원가입
DOJ logoDOJ

OI 서브태스크 채점, Elo 레이팅, Discord 인증을 갖춘 커뮤니티 온라인 저지.

문제
문제 목록카테고리
커뮤니티
대회랭킹게시판공지사항외부 대회 개최이용 안내
계정
로그인회원가입채점 현황
정책
이용약관DLC 이용 규칙개인정보 처리방침API 사용 설명서언어별 채점 환경대회 순위 보상레이팅과 퍼포먼스
© 2026 DOJ
모든 권리 보유
해설

67 sequence 1

문제로 돌아가기

해설

If a character 666 or 777 remains in the string, the condition is not satisfied. Therefore, every occurrence of 666 and 777 in the original string must be erased.

Conversely, if we erase exactly all occurrences of 666 and 777, the remaining string contains neither 666 nor 777. Hence the answer is the number of occurrences of the characters 666 and 777 in SSS.

We can compute it by scanning the string once. The time complexity is O(N)O(N)O(N) and the memory complexity is O(1)O(1)O(1).