Repository navigation
Expand file tree
/
Copy pathC++.cpp
More file actions
92 lines (86 loc) · 1.4 KB
/
Copy pathC++.cpp
File metadata and controls
92 lines (86 loc) · 1.4 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
83
84
85
86
87
88
89
90
91
92
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_DIGIT = 300;
string getDigit(string s, int start, int end)
{
string r = "";
for (int i = start; i < end; i++)
{
r += s[i];
}
return r;
}
int main()
{
string line1, line2, line3;
getline(cin, line1);
getline(cin, line2);
getline(cin, line3);
int answer[MAX_DIGIT], lengthLine = line1.length() / 3;
for (int i = 0; i < lengthLine; i++)
{
string l1 = getDigit(line1, i * 3, i * 3 + 3);
string l2 = getDigit(line2, i * 3, i * 3 + 3);
string l3 = getDigit(line3, i * 3, i * 3 + 3);
if (l1 != " _ ")
{
if (l2 == " |")
{
answer[i] = 1;
}
else
{
answer[i] = 4;
}
}
else if (l3 == "|_|")
{
if (l2 == "| |")
{
answer[i] = 0;
}
else if (l2 == "|_ ")
{
answer[i] = 6;
}
else
{
answer[i] = 8;
}
}
else if (l2 == " _|")
{
if (l3 == "|_ ")
{
answer[i] = 2;
}
else
{
answer[i] = 3;
}
}
else if (l3 == " _|")
{
if (l2 == "|_|")
{
answer[i] = 9;
}
else
{
answer[i] = 5;
}
}
else
{
answer[i] = 7;
}
}
for (int i = 0; i < lengthLine; i++)
{
cout << answer[i];
}
cout << '\n';
}