CF1569A Balanced Substring

题目描述

给一个长度为 $n$($1\le n \le50$)仅由 a 和 b 组成的字符串(字符的编号由 $1$ 到 $n$),找到任意一对 $l$ 和 $r$($1\le l

输入格式

第一行为一个正整数 $t$($1\le t\le1000$),表示有 $t$ 组数据。 接下来 $2\times t$ 行,输入每组数据。 每组数据一共两行。第一行为一个正整数 $n$,表示字符串长度;第二行为一个长度为 $n$ 仅由 a 和 b 组成的字符串。

输出格式

对于每组数据,输出一行两个数 $l$ 和 $r$。若找不到满足条件的 $l$ 和 $r$,输出两个 $-1$。(两个数之间用空格隔开,两组数据之间需换行) Translated by @银杉水杉秃杉 2021.9.13

说明/提示

In the first testcase there are no non-empty balanced subtrings. In the second and third testcases there are multiple balanced substrings, including the entire string "abbaba" and substring "baba".