/home/toolbox/public_html/solutions/127/12770/b.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /*
16 * Author: Isaac Traxler
17 * Date: 2015-09-29
18 * Purpose: fun
19 * Problem: 12770
20 */
21
22 /*
23 * This template reads data until a terminating value is reached.
24 */
25
26 #define MAX_SIZE 505
27
28 char buff[MAX_SIZE];
29 int let[26];
30
31 void init()
32 {
33 /* FUNCTION init */
34 int i;
35
36 for (i=0; i<26; i++)
37 {
38 /* for */
39 let[i] = 0;
40 } /* for */
41 } /* FUNCTION init */
42
43 void dump()
44 {
45 /* FUNCTION dump */
46 } /* FUNCTION dump */
47
48 int getInput()
49 {
50 /* FUNCTION getInput */
51 int dataReadFlag;
52
53 fgets(buff, MAX_SIZE, stdin);
54 buff[strlen(buff) - 1] = 0;
55 dataReadFlag = ('#' != buff[0]);
56 DEBUG printf("[%s] %d\n", buff, strlen(buff));
57 return (dataReadFlag);
58 } /* FUNCTION getInput */
59
60 void process()
61 {
62 /* FUNCTION process */
63 int i;
64 char prv;
65
66 for (i=0; i<strlen(buff); i++)
67 {
68 /* for each character */
69 let[buff[i]-'a']++;
70 } /* for each character */
71 prv = ' ';
72 for (i=0; i<26; i++)
73 {
74 /* for each letter */
75 if (1 == (let[i] % 2))
76 {
77 /* found an odd count */
78 if (' ' != prv)
79 {
80 printf("%c", prv);
81 }
82 prv = i + 'a';
83 } /* found an odd count */
84 } /* for each letter */
85 printf("\n");
86 } /* FUNCTION process */
87
88 int main()
89 {
90 /* main */
91 int moreToDo;
92
93 moreToDo = getInput();
94 while (moreToDo)
95 {
96 /* while */
97 init();
98 process();
99 moreToDo = getInput();
100 } /* while */
101
102 return EXIT_SUCCESS;
103 } /* main */
104