diff --git "a/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" new file mode 100644 index 00000000..7987b686 --- /dev/null +++ "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" @@ -0,0 +1,23 @@ +import sys +S = sys.stdin.readline().strip() + ' ' # 마지막에 공백 더하기 +stack = [] +result = '' +cnt = 0 # 괄호 안에 있는지 여부 +for i in S : + if i == '<' : # <를 만나면 + cnt = 1 # 지금 괄호 안에 있음 표시 + for _ in range(len(stack)): #괄호 만나기 이전 stack 비우고 다 뒤집어서 더하기 + result += stack.pop() + stack.append(i) + + if i == '>' : # >를 만나면 + cnt = 0 # 지금 괄호 빠져 나왔음 표시 + for _ in range(len(stack)): # 괄호 안에 있는 애들은 뒤집지 않고 더하기 + result += stack.pop(0) + + if i == ' ' and cnt == 0: # 공백을 만나고 괄호 밖에 있다면 + stack.pop() # 공백 빼기 + for _ in range(len(stack)): # 뒤집어서 더하기 + result += stack.pop() + result += ' ' +print(result) \ No newline at end of file diff --git "a/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" new file mode 100644 index 00000000..33f042a2 --- /dev/null +++ "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" @@ -0,0 +1,11 @@ +N = int(input()) +dic = {} # 확장자를 담아줄 딕셔너리 +for i in range(N): + _, extend = input().split('.') # .기준으로 문자열 분리 + if extend in dic: # 딕셔너리에 확장자가 있다면 개수를 추가 + dic[extend] += 1 + else: # 없다면 새로 등록 + dic[extend] = 1 + +for key in sorted(dic.keys()): # 딕셔너리의 key를 오름차순 정렬 + print(key, dic[key]) \ No newline at end of file diff --git a/week7/simulation/ZOAC3/hwangjaehee.py b/week7/simulation/ZOAC3/hwangjaehee.py new file mode 100644 index 00000000..38549ae1 --- /dev/null +++ b/week7/simulation/ZOAC3/hwangjaehee.py @@ -0,0 +1,48 @@ +from sys import stdin + +l, r = map(str, stdin.readline().rstrip().split()) # 왼손과 오른손 검지손가락의 초기 위치 문자 읽기 +string = stdin.readline().rstrip() #입력해야 할 문자열을 읽기 + +keyboard = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] +mo = 'yuiophjklbnm' #모음 리스트 +xl, yl, xr, yr = None, None, None, None #왼손좌표행렬, 오른손 좌표 행렬(초기화) + +# 키보드 배열을 순회하며 왼손과 오른손 검지손가락의 초기 위치 문자에 해당하는 좌표 찾기기 +for i in range(len(keyboard)): + # 현재 행 keyboard[i]에 왼손 초기 위치 문자 l이 있는지 확인 + if l in keyboard[i]: # 있다면 해당 행 i와 해당 문자의 열 인덱스를 찾아 xl, yl에 저장합니다. + xl, yl = i, keyboard[i].index(l) + + # 오른손 초기 위치 문자 r이 있는지 확인 + if r in keyboard[i]: # 있다면 해당 행 i와 해당 문자의 열 인덱스를 찾아 xr, yr에 저장 + xr, yr = i, keyboard[i].index(r) + +ans = 0 # 총 걸린 시간을 저장할 변수를 초기화 +for s in string: + ans += 1 # 각 문자를 누르는 데 기본적으로 1만큼의 시간이 소요 + + #오른손으로 눌러야 하는 경우(모음) + if s in mo: + for i in range(len(keyboard)): + if s in keyboard[i]: # 문있다면 해당 행 i와 해당 문자의 열 인덱스를 nx, ny에 저장 + nx = i + ny = keyboard[i].index(s) + # 맨해튼 거리 = |행 차이| + |열 차이| + ans += abs(xr - nx) + abs(yr - ny) + + xr, yr = nx, ny + break # 문자를 찾았으므로 내부 루프는 중단하고 다음 문자로 넘어가기기 + + #왼손으로 눌러야 하는 경우 + else: + for i in range(len(keyboard)): + if s in keyboard[i]: + nx = i + ny = keyboard[i].index(s) + + ans += abs(xl - nx) + abs(yl - ny) + + xl, yl = nx, ny + break + +print(ans) \ No newline at end of file