File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import sys
2+
3+ input = sys .stdin .readline
4+
5+
6+ def setOptions (option ):
7+ # 1. 각 단어의 첫 글자 우선 확인
8+ for i in range (len (option )):
9+ if option [i ][0 ].upper () not in shortcut_key :
10+ shortcut_key .add (option [i ][0 ].upper ())
11+ option [i ] = f"[{ option [i ][0 ]} ]{ option [i ][1 :]} "
12+ return option
13+
14+ # 2. 전체 단어의 모든 글자 중 아직 등록되지 않은 글자 탐색
15+ for i in range (len (option )):
16+ for j in range (len (option [i ])):
17+ if option [i ][j ].upper () not in shortcut_key :
18+ shortcut_key .add (option [i ][j ].upper ())
19+ option [i ] = f"{ option [i ][:j ]} [{ option [i ][j ]} ]{ option [i ][j + 1 :]} "
20+ return option
21+
22+ # 3. 지정할 수 있는 단축키가 없는 경우
23+ return option
24+
25+
26+ N = int (input ())
27+ shortcut_key = set ()
28+
29+ for _ in range (N ):
30+ option = input ().split ()
31+ result = setOptions (option )
32+ print (' ' .join (result ))
You can’t perform that action at this time.
0 commit comments