blob: 78efd6023ff8d2a6fbb94c2c6110c5373a5853b7 (
plain)
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
|
#include <stdint.h>
#include <stdio.h>
#include <ctype.h>
int main() {
char c;
int n = 0;
int count = 0;
int skipLine = 0;
while ((c = getchar()) != EOF) {
if (skipLine && c != '\n') continue;
if (isxdigit(c)) {
++count;
n <<= 4;
if (isdigit(c)) {
n |= c - '0';
} else {
n += 10 + tolower(c) - 'a';
}
}
if (count >= 2 || (count && !isxdigit(c))) {
putchar(n);
n = count = 0;
}
skipLine = c == '#';
}
return 0;
}
|