관리 메뉴

솜씨좋은장씨

[BaekJoon] 26545번 : Reverse (Python) 본문

Programming/코딩 1일 1문제

[BaekJoon] 26545번 : Reverse (Python)

솜씨좋은장씨 2022. 12. 24. 12:24
728x90
반응형

코딩 1일 1문제! 오늘의 문제는 백준의 Reverse 입니다.

 

26546번: Reverse

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will be one line with a string and two integers i and j, separated by spaces. The first int, i, is the start index of the substring to be taken

www.acmicpc.net

👨🏻‍💻 코드 ( Solution )

def reverse(string, start_idx, end_idx):
    return "".join([word[1] for word in enumerate(string) if int(start_idx) > word[0] or word[0] >= int(end_idx)])


if __name__ == "__main__":
    for _ in range(int(input())):
        string, start_idx, end_idx = input().split()
        
        print(reverse(string=string, start_idx=start_idx, end_idx=end_idx))
 

GitHub - SOMJANG/CODINGTEST_PRACTICE: 1일 1문제 since 2020.02.07

1일 1문제 since 2020.02.07. Contribute to SOMJANG/CODINGTEST_PRACTICE development by creating an account on GitHub.

github.com

Comments