-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (22 loc) · 695 Bytes
/
Copy pathmain.cpp
File metadata and controls
29 lines (22 loc) · 695 Bytes
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
// Entry point
import std;
import textutils;
using namespace std;
auto main() -> int {
// test
using text_tools::is_balanced;
auto test_cases = {
"([]){}<>", // balanced
"([{}])", // balanced
"((()))", // balanced
"({[}])", // unbalanced
"((())", // unbalanced
"({})]", // unbalanced
"", // balanced (empty string)
"abc", // balanced (no brackets)
"[({})]abc" // balanced (brackets followed by text)
};
for(const auto& test_case: test_cases) {
println("is_balanced(\"{}\") = {}", test_case, is_balanced(test_case));
}
}