Add .clang-format and apply it

This commit is contained in:
2021-12-02 07:18:16 +00:00
parent e58dede1b6
commit cd5e2538df
103 changed files with 2714 additions and 2132 deletions

View File

@@ -3,8 +3,10 @@
#include <string>
#include <vector>
struct PasswordChecker {
PasswordChecker(std::string const &s) {
struct PasswordChecker
{
PasswordChecker(std::string const& s)
{
std::size_t pos = 0;
min_ = std::stoul(s, &pos, 10);
assert(s[pos] == '-');
@@ -17,7 +19,8 @@ struct PasswordChecker {
password_ = s2.substr(pos + 4);
}
bool is_valid() const {
bool is_valid() const
{
std::string::size_type count = 0;
for (auto c : password_) {
if (c == c_) {
@@ -34,13 +37,15 @@ struct PasswordChecker {
std::string password_;
};
int main(int argc, char **argv) {
int main(int argc, char** argv)
{
unsigned count = 0;
for (std::string line; std::getline(std::cin, line);) {
PasswordChecker check(line);
if (check.is_valid()) {
++count;
} else {
}
else {
std::cout << "IN";
}
std::cout << "VALID: " << line << "\n";