/home/toolbox/public_html/solutions/122/12289/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 <stdlib.h>
7 #include <math.h>
8 #include <stdint.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 #define MAX_LENGTH 33
16
17 /* fprintf(stderr, "functionName: message", varslist); */
18
19 /*
20 * Author: Isaac Traxler
21 * Date: 2014-10-26
22 * Purpose: UVA Hack-a-thon
23 * Problem: 12289 - One-Two-Three
24 */
25
26 /*
27 * This template reads data a specified number of times.
28 */
29
30 int numberOfTimes;
31 char line[MAX_LENGTH];
32
33 void init()
34 {
35 /* FUNCTION init */
36 scanf("%d ", &numberOfTimes);
37 } /* FUNCTION init */
38
39 void dump()
40 {
41 /* FUNCTION dump */
42 } /* FUNCTION dump */
43
44 void getInput()
45 {
46 /* FUNCTION getInput */
47 scanf(" %s ", line);
48 } /* FUNCTION getInput */
49
50 void process()
51 {
52 /* FUNCTION process */
53 int tot = 0;
54
55 if (5 == strlen(line))
56 printf("3\n");
57 else
58 {
59 /* have either a 1 or a 2 */
60 if ('o' == line[0])
61 {
62 tot++;
63 }
64 if ('n' == line[1])
65 {
66 tot++;
67 }
68 if ('e' == line[2])
69 {
70 tot++;
71 }
72 if (1 < tot)
73 printf("1\n");
74 else
75 printf("2\n");
76 } /* have either a 1 or a 2 */
77 } /* FUNCTION process */
78
79 int main ()
80 {
81 /* main */
82 int i;
83
84 init();
85 for (i=0; i<numberOfTimes; i++)
86 {
87 /* while */
88 getInput();
89 process();
90 } /* while */
91
92 return EXIT_SUCCESS;
93 } /* main */
94
95