/home/toolbox/public_html/solutions/102/10282/b.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 <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9
10 #include <string>
11 #include <map>
12 #include <iostream>
13
14 using namespace std;
15
16 #define TRUE (1 == 1)
17 #define FALSE (1 != 1)
18
19 #define DEBUG if (FALSE)
20
21
22 /*
23 * Author: Isaac Traxler
24 * Date: 2018-09-18
25 * Purpose: fun
26 * Problem: 10282
27 */
28
29 /*
30 * This template reads lines of data at a time until end of file.
31 */
32 #define MAX_LINE 30
33
34 char line[MAX_LINE];
35 std::map<string,string> dct;
36
37 void init()
38 {
39 /* FUNCTION init */
40 char eng[MAX_LINE];
41 char frg[MAX_LINE];
42 int i;
43 int j;
44
45 fgets(line, MAX_LINE, stdin);
46 line[strlen(line)-1] = 0;
47 while (0 < strlen(line))
48 {
49 /* load dictionary */
50 for (i=0; (' ' != line[i]); i++)
51 {
52 /* grab first word */
53 eng[i] = line[i];
54 } /* grab first word */
55 eng[i] = '\0';
56 i++;
57 for (j=0; strlen(line)>i; i++,j++)
58 {
59 /* get second word */
60 frg[j] = line[i];
61 } /* get second word */
62 frg[j] = '\0';
63 dct[frg] = eng;
64 printf("[%s] [%s] [%s] dct[%s] = ", line, eng, frg, frg);
65 cout << "(" << dct[frg] << ")\n";
66 fgets(line, MAX_LINE, stdin);
67 line[strlen(line)-1] = 0;
68 } /* load dictionary */
69
70 } /* FUNCTION init */
71
72 int main()
73 {
74 /* main */
75
76 init();
77
78 return EXIT_SUCCESS;
79 } /* main */
80