logo AlgoBeat OnlineJudge
登录 注册

#215839. [JAG 2025 Summer Camp #3] Word Search

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

题目描述

You are given a word written in an unfamiliar language. In this language, a syllable is known to be one of the following:

  • A single uppercase English letter
  • A single lowercase English letter
  • An uppercase English letter followed by a lowercase English letter

For example, "Ab", "A", and "c" can each form a syllable, but "IC", "pC", and "Jag" cannot.

When dividing a word into several contiguous substrings that are syllables, determine the minimum and maximum possible number of distinct syllables among them.

输入格式

The input consists of multiple test cases.

The first line contains an integer (), representing the number of test cases.

test cases follow. Each test case is given in the following format.

For each test case, the only line contains a string (), consisting of uppercase and lowercase English letters.

Additionally, the sum of the lengths of over all test cases does not exceed .

输出格式

Output lines. For each test case, output the minimum and maximum possible numbers of distinct syllables in , in this order, separated by a space.

样例

样例输入 1

3
RaRa
ICPCJAG
BuRiShaBuShaBuRiBu

样例输出 1

1 3
6 6
4 10

数据范围与提示

In the first test case, the word “RaRa” can be divided into syllables in the following ways: “Ra” + “Ra”, “Ra” + “R” + “a”, “R” + “a” + “Ra”, and “R” + “a” + “R” + “a”. Here, + denotes string concatenation. For each division, the number of distinct syllables is , , , and , respectively. Therefore, the minimum is and the maximum is .