-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·82 lines (75 loc) · 1.45 KB
/
Copy pathsol.cpp
File metadata and controls
executable file
·82 lines (75 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, char> M = {
{"clank", 'A'},
{"bong", 'B'},
{"click", 'C'},
{"tap", 'D'},
{"poing", 'E'},
{"clonk", 'F'},
{"clack", 'G'},
{"ping", 'H'},
{"tip", 'I'},
{"cloing", 'J'},
{"tic", 'K'},
{"cling", 'L'},
{"bing", 'M'},
{"pong", 'N'},
{"clang", 'O'},
{"pang", 'P'},
{"clong", 'Q'},
{"tac", 'R'},
{"boing", 'S'},
{"boink", 'T'},
{"cloink", 'U'},
{"rattle", 'V'},
{"clock", 'W'},
{"toc", 'X'},
{"clink", 'Y'},
{"tuc", 'Z'},
{"whack", ' '},
{"bump", '^'},
{"pop", '<'},
{"dink", '1'},
{"thumb", '0'},
};
int main()
{
int n;
cin >> n;
list<char> L;
bool shift = false;
bool caps = false;
for (int i = 0; i < n; ++i)
{
string s;
cin >> s;
char c = M[s];
if (c == '<')
{
if (L.size())
L.pop_back();
}
else if (c == ' ')
L.push_back(c);
else if (c == '^')
caps = !caps;
else if (c == '0')
shift = false;
else if (c == '1')
shift = true;
else
{
if ((caps && !shift) || (shift && !caps))
L.push_back(c);
else
L.push_back(c + 97 - 65);
}
}
for (const auto &each : L)
{
cout << each;
}
cout << endl;
return 0;
}