logo AlgoBeat OnlineJudge
登录 注册

#208574. [USACO23OPEN] FEB B

内存限制:256 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Bessie and Elsie are plotting to overthrow Farmer John at last! They plan it out over text messages. Their conversation can be represented by a string of length where is either B or E, meaning the 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 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 . 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 .

输入格式

The first line will consist of one integer .

The next line contains .

输出格式

First output , the number of distinct excitement levels possible. On the next 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

数据范围与提示

.

  • Inputs 4-8: .
  • Inputs 9-20: No additional constraints.