# include <stdio.h> # include <string.h>
int n, h, t; char str[100005];
int main() { while(scanf("%d", &n), n) { scanf("%s", str); int sh = 0, h = 0, t = 0, st = 0, L = strlen(str); for(int i = 0; i < L; i ++) { if(str[i] == 'H') h ++; if(str[i] == 'T') t ++; } if( h % 2 || t % 2) { puts("-1"); continue; } for(int i = 0; i < L / 2; i ++) { if(str[i] == 'H') sh ++; if(str[i] == 'T') st ++; } int head = 0, tail = L / 2; while(sh != h / 2) { if(str[head] == 'H') sh --; if(str[head] == 'T') st --; if(str[tail] == 'H') sh ++; if(str[tail] == 'T') st ++; head ++; tail ++; } if(head != 0) printf("2\n%d ", head); else printf("1\n"); printf("%d\n", tail); } }
|