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) +}