summaryrefslogtreecommitdiffstats
path: root/inf/priprave/dn/1a.c
blob: 84b2c0861dfc2fadc4bcd4f436c1ea13df13dc93 (plain) (blame)
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
#include <stdio.h>
#include <stdlib.h>
/* https://codeforces.com/group/Eu6CNrz8hK/contest/349888/problem/A */
int main (void) { /* TIL: od ISO C11 je to legalno */
	unsigned short int num1 = 9;
	unsigned short int num2 = 10;
	int c;
	while (getchar() != '\n');
	while (1) {
		if ((c = getchar()) == EOF)
			break;
		if (c == '\n')
			num2 = 9;
		if (c <= '9' && c >= '1')
#define num (*(num2 > 9 ? &num1 : &num2))
			if (c-'0' < num)
				num = c-'0';
	}
	if (num1 == num2)
		printf("%d\n", num1);
	else if (num1 < num2)
		printf("%d%d\n", num1, num2);
	else
		printf("%d%d\n", num2, num1);
	return 0;
}