/home/toolbox/public_html/solutions/127/12770/a.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 scanf(" %s ", buff);
54 dataReadFlag = ('#' != buff[0]);
55 DEBUG printf("[%s] %d\n", buff, strlen(buff));
56 return (dataReadFlag);
57 } /* FUNCTION getInput */
58
59 void process()
60 {
61 /* FUNCTION process */
62 int i;
63 char prv;
64
65 for (i=0; i<strlen(buff); i++)
66 {
67 /* for each character */
68 let[buff[i]-'a']++;
69 } /* for each character */
70 prv = ' ';
71 for (i=0; i<26; i++)
72 {
73 /* for each letter */
74 if (1 == (let[i] % 2))
75 {
76 /* found an odd count */
77 if (' ' != prv)
78 {
79 printf("%c", prv);
80 }
81 prv = i + 'a';
82 } /* found an odd count */
83 } /* for each letter */
84 printf("\n");
85 } /* FUNCTION process */
86
87 int main()
88 {
89 /* main */
90 int moreToDo;
91
92 moreToDo = getInput();
93 while (moreToDo)
94 {
95 /* while */
96 init();
97 process();
98 moreToDo = getInput();
99 } /* while */
100
101 return EXIT_SUCCESS;
102 } /* main */
103