From 8bafde0fde840d32b1017f8e440d1d6813757f18 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sat, 25 Oct 2025 22:02:54 +0900 Subject: [PATCH] 20251025 baekjoon --- code_study/Baekjoon/c/2744.c | 16 ++++++++++++++++ code_study/Baekjoon/python/2744.py | 2 ++ code_study/Baekjoon/swift/2744.swift | 12 ++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 code_study/Baekjoon/c/2744.c create mode 100644 code_study/Baekjoon/python/2744.py create mode 100644 code_study/Baekjoon/swift/2744.swift diff --git a/code_study/Baekjoon/c/2744.c b/code_study/Baekjoon/c/2744.c new file mode 100644 index 0000000..c38dfd9 --- /dev/null +++ b/code_study/Baekjoon/c/2744.c @@ -0,0 +1,16 @@ +#include + +int main() { + char str[101]; + scanf("%s",str); + + int idx = 0; + while(str[idx] != '\0') { + if('A' <= str[idx] && str[idx] <= 'Z') str[idx++] += 32; + else if('a' <= str[idx] && str[idx] <= 'z') str[idx++] -= 32; + } + + printf("%s\n",str); + + return 0; +} \ No newline at end of file diff --git a/code_study/Baekjoon/python/2744.py b/code_study/Baekjoon/python/2744.py new file mode 100644 index 0000000..952285d --- /dev/null +++ b/code_study/Baekjoon/python/2744.py @@ -0,0 +1,2 @@ +print(''.join([(lambda c: c.upper())(c) if c.islower() else c.lower() for c in input()])) +#print(input().swapcase()) \ No newline at end of file diff --git a/code_study/Baekjoon/swift/2744.swift b/code_study/Baekjoon/swift/2744.swift new file mode 100644 index 0000000..9299c80 --- /dev/null +++ b/code_study/Baekjoon/swift/2744.swift @@ -0,0 +1,12 @@ +if let str = readLine() { + let result = str.map { c in + if c.isUppercase { + return c.lowercased() + } + else { + return c.uppercased() + } + }.joined() + + print(result) +}