-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZoloto_plemeni_ABBA.cpp
93 lines (93 loc) · 1.65 KB
/
Zoloto_plemeni_ABBA.cpp
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
93
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
string a, b, c, t1, t2;
ifstream in("input.txt");
in >> a >> b >> c;
in.close();
ofstream out("output.txt");
if (a.length() > b.length() && a.length() > c.length())
out << a;
else
{
if (b.length() > a.length() && b.length() > c.length())
out << b;
else
if (c.length() > a.length() && c.length() > b.length())
out << c;
else
{
if (a.length() == b.length() && a.length() == c.length())
{
for (int i = 0; i < a.length(); i++)
{
if (a[i] > b[i] && a[i] > c[i])
{
out << a;
break;
}
if (b[i] > a[i] && b[i] > c[i])
{
out << b;
break;
}
if (c[i] > a[i] && c[i] > b[i])
{
out << c;
break;
}
if (i == a.length() - 1)
{
if (a == b && a == c)
out << a;
else
if (a == b)
out << a;
else
if (a == c)
out << a;
else
if (b == c)
out << b;
}
}
}
else
{
if (a.length() == b.length())
{
t1 = a;
t2 = b;
}
if (a.length() == c.length())
{
t1 = a;
t2 = c;
}
if (b.length() == c.length())
{
t1 = b;
t2 = c;
}
for (int i = 0; i < t1.length(); i++)
{
if (t1[i] > t2[i])
{
out << t1;
break;
}
if (t2[i] > t1[i])
{
out << t2;
break;
}
if (i == t1.length()-1) out << t1;
}
}
}
}
out.close();
return 0;
}