You would like to set a password for a bank account. However, there are three restrictions on the format of the password:
- it has to contain only alphanumerical characters (a−z, A−Z, 0−9);
- there should be an even number of letters;
- there should be an odd number of digits.
You are given a string S consisting of N characters. String S can be divided into words by splitting it at, and removing, the spaces. The goal is to choose the longest word that is a valid password. You can assume that if there are K spaces in string S then there are exactly K + 1 words.
For example, given "test 5 a0A pass007 ?xy1", there are five words and three of them are valid passwords: "5", "a0A" and "pass007". Thus the longest password is "pass007" and its length is 7. Note that neither "test" nor "?xy1" is a valid password, because "?" is not an alphanumerical character and "test" contains an even number of digits (zero).
Write a function:
def solution(S)
that, given a non-empty string S consisting of N characters, returns the length of the longest word from the string that is a valid password. If there is no such word, your function should return −1.
For example, given S = "test 5 a0A pass007 ?xy1", your function should return 7, as explained above.
Assume that:
- N is an integer within the range [1..200];
- string S consists only of printable ASCII characters and spaces.
In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
<_sre.SRE_Match object; span=(0, 1), match='t'> <_sre.SRE_Match object; span=(0, 1), match='5'> <_sre.SRE_Match object; span=(0, 1), match='a'> <_sre.SRE_Match object; span=(0, 1), match='p'> None
Invalid result type, int expected, <class 'NoneType'> found.stdout:
<_sre.SRE_Match object; span=(0, 4), match='test'> <_sre.SRE_Match object; span=(0, 1), match='5'> <_sre.SRE_Match object; span=(0, 3), match='a0A'> <_sre.SRE_Match object; span=(0, 7), match='pass007'> <_sre.SRE_Match object; span=(0, 0), match=''>
Invalid result type, int expected, <class 'NoneType'> found.stdout:
<_sre.SRE_Match object; span=(0, 4), match='test'> <_sre.SRE_Match object; span=(0, 0), match=''> <_sre.SRE_Match object; span=(0, 1), match='a'> <_sre.SRE_Match object; span=(0, 4), match='pass'> <_sre.SRE_Match object; span=(0, 0), match=''>
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('[a-z]*')
lower = re.compile('[a-z]*')
lower = re.compile('[a-z]*')
print(pattern.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('[a-z]*')
upper = re.compile('[a-z]*')
n = re.compile('[a-z]*')
print(pattern.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('[a-z]*')
upper = re.compile('[A-Z]*')
numeric = re.compile('[0-9]*')
print(pattern.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('[a-z]*')
upper = re.compile('[A-Z]*')
numeric = re.compile('[0-9]*')
print(lower.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
<_sre.SRE_Match object; span=(0, 4), match='test'> <_sre.SRE_Match object; span=(0, 0), match=''> <_sre.SRE_Match object; span=(0, 1), match='a'> <_sre.SRE_Match object; span=(0, 4), match='pass'> <_sre.SRE_Match object; span=(0, 0), match=''>
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('[a-z]*')
upper = re.compile('[A-Z]*')
numeric = re.compile('?[0-9]*')
print(lower.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile('?[a-z]*')
upper = re.compile('?[A-Z]*')
numeric = re.compile('?[0-9]*')
print(lower.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Traceback (most recent call last): File "exec.py", line 123, in <module> main() File "exec.py", line 85, in main result = solution( S ) File "/tmp/solution.py", line 18, in solution valid_check(l) File "/tmp/solution.py", line 8, in valid_check lower = re.compile('?[a-z]*') File "/opt/lang/python3/lib/python3.6/re.py", line 233, in compile return _compile(pattern, flags) File "/opt/lang/python3/lib/python3.6/re.py", line 301, in _compile p = sre_compile.compile(pattern, flags) File "/opt/lang/python3/lib/python3.6/sre_compile.py", line 562, in compile p = sre_parse.parse(p, flags) File "/opt/lang/python3/lib/python3.6/sre_parse.py", line 855, in parse p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0) File "/opt/lang/python3/lib/python3.6/sre_parse.py", line 416, in _parse_sub not nested and not items)) File "/opt/lang/python3/lib/python3.6/sre_parse.py", line 616, in _parse source.tell() - here + len(this)) sre_constants.error: nothing to repeat at position 0
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.match(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
<_sre.SRE_Match object; span=(0, 4), match='test'> <_sre.SRE_Match object; span=(0, 0), match=''> <_sre.SRE_Match object; span=(0, 1), match='a'> <_sre.SRE_Match object; span=(0, 4), match='pass'> <_sre.SRE_Match object; span=(0, 0), match=''>
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', ''] ['', ''] ['a', '', '', ''] ['pass', '', '', '', ''] ['', 'xy', '', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.find(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.find(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Traceback (most recent call last): File "exec.py", line 123, in <module> main() File "exec.py", line 85, in main result = solution( S ) File "/tmp/solution.py", line 18, in solution valid_check(l) File "/tmp/solution.py", line 11, in valid_check print(lower.find(s)) AttributeError: '_sre.SRE_Pattern' object has no attribute 'find'
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', ''] ['', ''] ['a', '', '', ''] ['pass', '', '', '', ''] ['', 'xy', '', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
upper = re.compile(r'[A-Z]*')
numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', ''] ['5', ''] ['a0A', ''] ['pass007', ''] ['', 'xy1', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['test', ''] ['5', ''] ['a0A', ''] ['pass007', ''] ['', 'xy1', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.s(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.search(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] <_sre.SRE_Match object; span=(0, 4), match='test'> <_sre.SRE_Match object; span=(0, 1), match='5'> <_sre.SRE_Match object; span=(0, 3), match='a0A'> <_sre.SRE_Match object; span=(0, 7), match='pass007'> <_sre.SRE_Match object; span=(0, 0), match=''>
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-zA-Z0-9]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['test', ''] ['5', ''] ['a0A', ''] ['pass007', ''] ['', 'xy1', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]*')
# upper = re.compile(r'[A-Z]*')
# numeric = re.compile(r'[0-9]*')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['test', ''] ['', ''] ['a', '', '', ''] ['pass', '', '', '', ''] ['', 'xy', '', '']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['t', 'e', 's', 't'] [] ['a'] ['p', 'a', 's', 's'] ['x', 'y']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['test'] [] ['a'] ['pass'] ['xy']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = lower = re.compile(r'[a-z]+')
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'^[a-zA-Z0-9]+')
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(lower.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'^[a-zA-Z0-9]+')
lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
print(lst)
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test', '5', 'a0A', 'pass007', '?xy1'] ['test'] ['5'] ['a0A'] ['pass007'] []
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'^[a-zA-Z0-9]+')
# lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test'] ['5'] ['a0A'] ['pass007'] []
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'^[a-zA-Z0-9]+')
# lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'^[a-zA-Z0-9]+')
# lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test'] ['5'] ['a0A'] ['pass007'] []
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['a']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[a-zA-Z0-9]+')
# lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
# lower = re.compile(r'[a-z]+')
# upper = re.compile(r'[A-Z]')
# numeric = re.compile(r'[0-9]')
print(e.findall(s))
def solution(S):
lst = S.split(" ")
for l in lst:
valid_check(l)
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
[] [] [] [] ['?']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['?']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
print(e.findall(s))
if e:
return False
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
[] [] [] [] ['?']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['?']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
if e:
return False
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
if e:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
4 1 3 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
check
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
re.compile(r'[^a-zA-Z0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
digit =
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
check = letter.findall()
digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
print(check)
# letter = re.compile(r'[^a-zA-Z]+')
# check = letter.findall()
# digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
[] 4 [] 1 [] 3 [] 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
print(check)
letter = re.compile(r'[^a-zA-Z]+')
check = letter.findall()
digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
check = letter.findall(s)
digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[^a-zA-Z]+')
check = letter.findall(s)
print(check)
# digit = re.compile(r'[^0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
[] 4 ['5'] 1 ['0'] 3 ['007'] 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
print(check)
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
['test'] 4 [] 1 ['a', 'A'] 3 ['pass'] 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
print(''check)
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
print(''.join(check))
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
test 4 1 aA 3 pass 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check))
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 0:
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 != 0:
return False
# digit = re.compile(r'[0-9]+')
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 != 0:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 != 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 != 0:
return False
letter = re.compile(r'[0-9]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
letter = re.compile(r'[0-9]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
e = re.compile(r'[^a-zA-Z0-9]+')
check = e.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
['a?xy1']
Invalid result type, int expected, <class 'NoneType'> found.stdout:
1 3 7
Invalid result type, int expected, <class 'NoneType'> found.
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
m
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = 0
lst = S.split(" ")
for l in lst:
if valid_check(l):
print(len(l))
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = 0
lst = S.split(" ")
for l in lst:
if valid_check(l):
answer = max(answer, len(l))
return answer
['a?xy1']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = -
lst = S.split(" ")
for l in lst:
if valid_check(l):
answer = max(answer, len(l))
return answer
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = -1
lst = S.split(" ")
for l in lst:
if valid_check(l):
answer = max(answer, len(l))
return answer
['a?xy1']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = -1
lst = S.split(" ")
for l in lst:
if valid_check(l):
answer = max(answer, len(l))
return answer
['a?xy1']
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
import re
def valid_check(s):
na = re.compile(r'[^a-zA-Z0-9]+')
check = na.findall(s)
if check:
return False
letter = re.compile(r'[a-zA-Z]+')
check = letter.findall(s)
if len(''.join(check)) % 2 == 1:
return False
digit = re.compile(r'[0-9]+')
check = digit.findall(s)
if len(''.join(check)) % 2 == 0:
return False
return True
def solution(S):
answer = -1
lst = S.split(" ")
for l in lst:
if valid_check(l):
answer = max(answer, len(l))
return answer
The solution obtained perfect score.