We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e058631 commit b576f2eCopy full SHA for b576f2e
strings/baekjoon/11655/solution.c
@@ -0,0 +1,31 @@
1
+#include <stdio.h>
2
+#include <string.h>
3
+
4
+int main(void) {
5
+ char s[128] = "";
6
+ gets(s);
7
+ int s_length = strlen(s);
8
9
+ char uppercase[26] = "NOPQRSTUVWXYZABCDEFGHIJKLM";
10
+ char lowercase[26] = "nopqrstuvwxyzabcdefghijklm";
11
12
+ // Include terminating null character
13
+ char ret[128] = "";
14
15
+ for (int index = 0 ; index < s_length ; index++) {
16
+ // 65: A, 90: Z
17
+ // 97: a, 122: z
18
+ int temp = (int)s[index];
19
+ if (65 <= temp && temp <= 90) {
20
+ ret[index] = uppercase[temp - 65];
21
+ } else if (97 <= temp && temp <= 122) {
22
+ ret[index] = lowercase[temp - 97];
23
+ } else {
24
+ ret[index] = s[index];
25
+ }
26
27
+ printf("%c", ret[index]);
28
29
30
+ return 0;
31
+}
0 commit comments