/home/toolbox/public_html/solutions/102/10226/a.cpp
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <math.h>
8 #include <stdint.h>
9 #include <map>
10 #include <iostream>
11 #include <cassert>
12
13
14 #define TRUE (1 == 1)
15 #define FALSE (1 != 1)
16
17 #define DEBUG if (FALSE)
18
19 /* fprintf(stderr, "functionName: message", varslist); */
20
21 /*
22 * Author: Isaac Traxler
23 * Date: 2018-11-05
24 * Purpose: fun
25 * Problem: 10226
26 */
27
28 /*
29 * This template reads data a specified number of times.
30 */
31
32 #define MAX_LENGTH 36
33 #define MAX_LENGTH_MINUS_1 35
34 #define TREE_MAX 10002
35
36 int numberOfTimes;
37 char buf[MAX_LENGTH];
38 std::vector <std::string, int> trees;
39
40 void init()
41 {
42 /* FUNCTION init */
43 scanf("%d ", &numberOfTimes);
44 /* skip over initial blank line */
45 fgets(buf, MAX_LENGTH_MINUS_1, stdin);
46 } /* FUNCTION init */
47
48 void dump()
49 {
50 /* FUNCTION dump */
51 int i;
52
53
54 } /* FUNCTION dump */
55
56
57 void getInput()
58 {
59 /* FUNCTION getInput */
60 char * tmp;
61
62 buf[0] = 'a';
63 tmp = fgets(buf, MAX_LENGTH_MINUS_1, stdin);
64 if (NULL == tmp)
65 {
66 buf[0] = 0;
67 }
68 while (33 < buf[0])
69 {
70 /* read another line */
71 if (trees.find(buf) != trees.end())
72 {
73 /* tree name found */
74 trees[buf] = trees[buf] + 1;
75 } /* tree name found */
76 else
77 {
78 /* new kind of tree */
79 trees[buf] = 1;
80 } /* new kind of tree */
81 tmp = fgets(buf, MAX_LENGTH_MINUS_1, stdin);
82 if (NULL == tmp)
83 {
84 buf[0] = 0;
85 }
86 } /* read another line */
87
88 } /* FUNCTION getInput */
89
90 void process()
91 {
92 /* FUNCTION process */
93 dump();
94 } /* FUNCTION process */
95
96 int main()
97 {
98 /* main */
99 int i;
100
101 init();
102 for (i=0; i<numberOfTimes; i++)
103 {
104 /* while */
105 getInput();
106 process();
107 } /* while */
108
109 return EXIT_SUCCESS;
110 } /* main */
111
112