#abc282c. C - String Delimiter

C - String Delimiter

Score : 300300 points

问题描述

你将得到一个长度为 NN 的字符串 SS,其中包含小写英文字母、,"。保证 SS 中包含偶数个 "

2K2K 表示 SS 中的 " 总数。对于每个 i=1,2,,Ki=1,2,\ldots,K,从第 (2i1)(2i-1)" 到第 (2i)(2i)" 的字符被视为 被包围 的字符。

你的任务是将 SS 中所有 未被包围, 替换为 .,并输出变换后的字符串。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a string SS of length NN consisting of lowercase English letters, ,, and ". It is guaranteed that SS contains an even number of ".

Let 2K2K be the number of " in SS. For each i=1,2,,Ki=1,2,\ldots,K, the characters from the (2i1)(2i-1)-th " through the (2i)(2i)-th " are said to be enclosed.

Your task is to replace each , in SS that is not an enclosed character with . and print the resulting string.

Constraints

  • NN is an integer between 11 and 2×1052\times 10^5, inclusive.
  • SS is a string of length NN consisting of lowercase English letters, ,, and ".
  • SS contains an even number of ".

Input

The input is given from Standard Input in the following format:

NN

SS

Output

Print the answer.

Sample Input 1

8
"a,b"c,d

Sample Output 1

"a,b"c.d

In SS, "a,b" are enclosed characters, and c,d are not.

The , in SS that is not an enclosed character is the seventh character from the left in SS, 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