Lei YU | 6520748 | 2019-10-11 16:39:36 +0800 | [diff] [blame] | 1 | #include <cstdio> |
2 | #include <string> | ||||
3 | #include <vector> | ||||
4 | |||||
Lei YU | 6520748 | 2019-10-11 16:39:36 +0800 | [diff] [blame] | 5 | int main(int argc, char** argv) |
6 | { | ||||
7 | if (argc < 2) | ||||
8 | { | ||||
9 | printf("Usage: %s versions...\n", argv[0]); | ||||
10 | return 1; | ||||
11 | } | ||||
12 | |||||
13 | std::vector<std::string> versions(argv + 1, argv + argc); | ||||
14 | std::string latest; | ||||
15 | for (const auto& s : versions) | ||||
16 | { | ||||
17 | if (latest < s) | ||||
18 | { | ||||
19 | latest = s; | ||||
20 | } | ||||
21 | } | ||||
22 | |||||
23 | printf("%s", latest.c_str()); | ||||
24 | return 0; | ||||
25 | } |