#abc282c. C - String Delimiter
C - String Delimiter
Score : points
问题描述
你将得到一个长度为 的字符串 ,其中包含小写英文字母、, 和 "。保证 中包含偶数个 "。
令 表示 中的 " 总数。对于每个 ,从第 个 " 到第 个 " 的字符被视为 被包围 的字符。
你的任务是将 中所有 未被包围 的 , 替换为 .,并输出变换后的字符串。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a string of length consisting of lowercase English letters, ,, and ". It is guaranteed that contains an even number of ".
Let be the number of " in . For each , the characters from the -th " through the -th " are said to be enclosed.
Your task is to replace each , in that is not an enclosed character with . and print the resulting string.
Constraints
- is an integer between and , inclusive.
- is a string of length consisting of lowercase English letters,
,, and". - contains an even number of
".
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
8
"a,b"c,d
Sample Output 1
"a,b"c.d
In , "a,b" are enclosed characters, and c,d are not.
The , in that is not an enclosed character is the seventh character from the left in , so replace that character with . to get the answer.
Sample Input 2
5
,,,,,
Sample Output 2
.....
Sample Input 3
20
a,"t,"c,"o,"d,"e,"r,
Sample Output 3
a."t,"c."o,"d."e,"r.
update @ 2024/3/10 11:49:56