A16418 | Unnatural Language Processing
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Lura was bored and decided to make a simple language using the five letters $\texttt{a}$ , $\texttt{b}$ , $\texttt{c}$ , $\texttt{d}$ , $\texttt{e}$ . There are two types of letters:
- vowels — the letters $\texttt{a}$ and $\texttt{e}$ . They are represented by $\textsf{V}$ .
- consonants — the letters $\texttt{b}$ , $\texttt{c}$ , and $\texttt{d}$ . They are represented by $\textsf{C}$ .
There are two types of syllables in the language: $\textsf{CV}$ (consonant followed by vowel) or $\textsf{CVC}$ (vowel with consonant before and after). For example, $\texttt{ba}$ , $\texttt{ced}$ , $\texttt{bab}$ are syllables, but $\texttt{aa}$ , $\texttt{eda}$ , $\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 $\texttt{bacedbab}$ , it would be split into syllables as $\texttt{ba.ced.bab}$ (the dot $\texttt{.}$ represents a syllable boundary).
- vowels — the letters $\texttt{a}$ and $\texttt{e}$ . They are represented by $\textsf{V}$ .
- consonants — the letters $\texttt{b}$ , $\texttt{c}$ , and $\texttt{d}$ . They are represented by $\textsf{C}$ .
There are two types of syllables in the language: $\textsf{CV}$ (consonant followed by vowel) or $\textsf{CVC}$ (vowel with consonant before and after). For example, $\texttt{ba}$ , $\texttt{ced}$ , $\texttt{bab}$ are syllables, but $\texttt{aa}$ , $\texttt{eda}$ , $\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 $\texttt{bacedbab}$ , it would be split into syllables as $\texttt{ba.ced.bab}$ (the dot $\texttt{.}$ represents a syllable boundary).
输入格式
The input consists of multiple test cases. The first line contains an integer $t$ ( $1 \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 $n$ ( $1 \leq n \leq 2 \cdot 10^5$ ) — the length of the word.
The second line of each test case contains a string consisting of $n$ lowercase Latin characters — the word.
All words given are valid words in the language; that is, they only use the letters $\texttt{a}$ , $\texttt{b}$ , $\texttt{c}$ , $\texttt{d}$ , $\texttt{e}$ , and each word is made up of several syllables.
The sum of $n$ over all test cases does not exceed $2 \cdot 10^5$ .
The first line of each test case contains an integer $n$ ( $1 \leq n \leq 2 \cdot 10^5$ ) — the length of the word.
The second line of each test case contains a string consisting of $n$ lowercase Latin characters — the word.
All words given are valid words in the language; that is, they only use the letters $\texttt{a}$ , $\texttt{b}$ , $\texttt{c}$ , $\texttt{d}$ , $\texttt{e}$ , and each word is made up of several syllables.
The sum of $n$ over all test cases does not exceed $2 \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.
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.
输入输出样例
输入 #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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted