CF1915D.Unnatural Language Processing

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Lura was bored and decided to make a simple language using the five letters a\texttt{a}, b\texttt{b}, c\texttt{c}, d\texttt{d}, e\texttt{e}. There are two types of letters:

  • vowels — the letters a\texttt{a} and e\texttt{e}. They are represented by V\textsf{V}.
  • consonants — the letters b\texttt{b}, c\texttt{c}, and d\texttt{d}. They are represented by C\textsf{C}.

There are two types of syllables in the language: CV\textsf{CV} (consonant followed by vowel) or CVC\textsf{CVC} (vowel with consonant before and after). For example, ba\texttt{ba}, ced\texttt{ced}, bab\texttt{bab} are syllables, but aa\texttt{aa}, eda\texttt{eda}, baba\texttt{baba} are not.

A word in the language is a sequence of syllables. Lura has written a word in the language, but she doesn't know how to split it into syllables. Help her break the word into syllables.

For example, given the word bacedbab\texttt{bacedbab}, it would be split into syllables as ba.ced.bab\texttt{ba.ced.bab} (the dot .\texttt{.} represents a syllable boundary).

卢拉感到无聊,决定用五个字母 a\texttt{a}、b\texttt{b}、c\texttt{c}、d\texttt{d}、e\texttt{e} 构造一种简单的语言。这些字母分为两类:

  • 元音字母 —— 字母 a\texttt{a} 和 e\texttt{e},用 V\textsf{V} 表示;
  • 辅音字母 —— 字母 b\texttt{b}、c\texttt{c} 和 d\texttt{d},用 C\textsf{C} 表示。

该语言中有两种类型的音节:CV\textsf{CV}(辅音后接元音)或 CVC\textsf{CVC}(元音前后均为辅音)。例如,ba\texttt{ba}、ced\texttt{ced}、bab\texttt{bab} 是合法的音节,但 aa\texttt{aa}、eda\texttt{eda}、baba\texttt{baba} 不是。

该语言中的一个“词”是由若干音节依次连接而成的序列。卢拉已写出一个符合该语言规则的词,但她不知道如何将其切分为音节。请帮她将这个词正确地分割为音节。

例如,对于词 bacedbab\texttt{bacedbab},应将其分割为音节 ba.ced.bab\texttt{ba.ced.bab}(其中圆点 .\texttt{.} 表示音节边界)。

输入格式

The input consists of multiple test cases. The first line contains an integer tt (1≤t≤1001 \leq t \leq 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer nn (1≤n≤2⋅1051 \leq n \leq 2 \cdot 10^5) — the length of the word.

The second line of each test case contains a string consisting of nn lowercase Latin characters — the word.

All words given are valid words in the language; that is, they only use the letters a\texttt{a}, b\texttt{b}, c\texttt{c}, d\texttt{d}, e\texttt{e}, and each word is made up of several syllables.

The sum of nn over all test cases does not exceed 2⋅1052 \cdot 10^5.

输入包含多个测试用例。第一行包含一个整数 tt(1≤t≤1001 \leq t \leq 100),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤2⋅1051 \leq n \leq 2 \cdot 10^5),表示单词的长度。

每个测试用例的第二行包含一个由 nn 个小写拉丁字母组成的字符串——该单词。

所有给定的单词均为该语言中的有效单词;即,它们仅使用字母 a\texttt{a}、b\texttt{b}、c\texttt{c}、d\texttt{d}、e\texttt{e},且每个单词均由若干音节构成。

所有测试用例的 nn 值之和不超过 2⋅1052 \cdot 10^5。

输出格式

For test case, output a string denoting the word split into syllables by inserting a dot .\texttt{.} between every pair of adjacent syllables.

If there are multiple possible splittings, output any of them. The input is given in such a way that at least one possible splitting exists.

对于测试用例,输出一个字符串,表示将单词按音节划分,并在每两个相邻音节之间插入一个点号 .\texttt{.}。

如果存在多种可能的划分方式,输出其中任意一种即可。输入数据保证至少存在一种合法的划分方式。

输入输出样例

  • 输入#1

    6
    8
    bacedbab
    4
    baba
    13
    daddecabeddad
    3
    dac
    6
    dacdac
    22
    dababbabababbabbababba

    输出#1

    ba.ced.bab
    ba.ba
    dad.de.ca.bed.dad
    dac
    dac.dac
    da.bab.ba.ba.bab.bab.ba.bab.ba

输入解题思路,AI测评打分。不知道怎么写?

首页