-
Notifications
You must be signed in to change notification settings - Fork 17
/
B.py
49 lines (31 loc) · 904 Bytes
/
B.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import sys
from typing import List
def read_int() -> int:
return int(sys.stdin.readline())
def read_list_int(length: int) -> List[int]:
result = list(map(int, sys.stdin.readline().split()))
assert (
len(result) == length
), f"List must of of length of {length}, but got {result}"
return result
def read_str() -> str:
return sys.stdin.readline()
def main() -> None:
string_len = read_int()
string = read_str().strip()
assert (
len(string) == string_len
), f"{string} length is {len(string)}, shoud be {string_len}"
result: List[str] = []
space = False
for char in string:
if char == "*":
space = True
else:
if space:
result.append(" ")
space = False
result.append(char)
print("".join(result))
if __name__ == "__main__":
main()