automated commit by check50 [check50=True]

This commit is contained in:
kukemuna 2024-02-25 11:56:39 +02:00
parent fdbdadc478
commit 4cc33d7bc1
1 changed files with 8 additions and 4 deletions

View File

@ -32,15 +32,19 @@ int validate_key(string key)
{
int sum = 0;
for (int i = 0; i < strlen(key); i++)
for (char c = 'A'; c <= 'Z'; c++)
{
if (isalpha(key[i]))
for (int i = 0; i < 26; i++)
{
sum += toupper(key[i]);
if (toupper(key[i]) == c)
{
sum++;
break;
}
}
}
if (sum == 2015) // Sum of 26 unique uppercase characters
if (sum == 26) // Sum of 26 unique uppercase characters, but also MMCcEFGHIJKLMNOPQRqTUVWXeZ
{
return 0;
}