-
Notifications
You must be signed in to change notification settings - Fork 0
/
2_Lab02_1.c
54 lines (40 loc) · 1 KB
/
2_Lab02_1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Baekjoon Online Judge # 2204
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
char arr[1000][20];
char newArr[1000][20];
char result[1000][20];
int main() {
int n;
int cnt = 0;
while (true) {
scanf("%d", &n);
if (n == 0) {
break;
}
for (int i = 0; i < n; i++) {
char c[20] = {};
scanf("%s", c);
for (int j = 0; j < sizeof(c); j++) {
arr[i][j] = c[j];
if (c[j] >= 'a' && c[j] <= 'z') {
c[j] = c[j] - 'a' + 'A';
}
}
for (int j = 0; j < sizeof(c); j++) {
newArr[i][j] = c[j];
}
}
int minIndex = 0;
for (int i = 0; i < n; i++) {
int cmpResult = 0;
cmpResult = strcmp(newArr[minIndex], newArr[i]);
if (cmpResult > 0) {
minIndex = i;
}
}
printf("%s\n", arr[minIndex]);
}
return 0;
}