0
Code coach challenge
It failed 3 test cases. Tried to complete it using regex alone but it failed to match the punctuations. #third if statement #if pa.match? /[@#
amp;*!%]/ print "Strong" #doesn't match https://code.sololearn.com/cA654G3rTYnA/?ref=app2 Answers
+ 8
input = gets.chomp
def check_special_char(input)
freqs = {}
y = 0
freqs.default = 0
input.each_char{|char|freqs[char]+=1}
["!", "@", "#", "quot;, "%", "&", "*"].each{|x| y+=freqs[x]}
return y
end
def check_numbers(input)
freqs = {}
y = 0
freqs.default = 0
input.each_char{|char|freqs[char]+=1}
("0".."9").each{|x| y+=freqs[x]}
return y
end
special = check_numbers(input)
number = check_special_char(input)
if input.length > 6 && special >1 && number >1
puts "Strong"
else
puts"Weak"
end
+ 1
AKR thanks but I want to know what's wrong with mine