Logo
(追記) (追記ここまで)

28034번 - FEB 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB2861008642.786%

문제

Bessie and Elsie are plotting to overthrow Farmer John at last! They plan it out over $N$ (1ドル\le N\le 2\cdot 10^5$) text messages. Their conversation can be represented by a string $S$ of length $N$ where $S_i$ is either $B$ or $E,ドル meaning the $i$th message was sent by Bessie or Elsie, respectively.

However, Farmer John hears of the plan and attempts to intercept their conversation. Thus, some letters of $S$ are $F,ドル meaning Farmer John obfuscated the message and the sender is unknown.

The excitement level of a non-obfuscated conversation is the number of times a cow double-sends - that is, the number of occurrences of substring $BB$ or $EE$ in $S$. You want to find the excitement level of the original message, but you don’t know which of Farmer John’s messages were actually Bessie’s / Elsie’s. Over all possibilities, output all possible excitement levels of $S$.

입력

The first line will consist of one integer $N$.

The next line contains $S$.

출력

First output $K,ドル the number of distinct excitement levels possible. On the next $K$ lines, output the excitement levels, in increasing order.

제한

예제 입력 1

4
BEEF

예제 출력 1

2
1
2

예제 입력 2

9
FEBFEBFEB

예제 출력 2

2
2
3

예제 입력 3

10
BFFFFFEBFE

예제 출력 3

3
2
4
6

힌트

출처

Olympiad > USA Computing Olympiad > 2022-2023 Season > USACO 2023 US Open Contest > Bronze 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /