Skip to content

Instantly share code, notes, and snippets.

@savonarola
Created September 2, 2009 20:56
Show Gist options
  • Save savonarola/179950 to your computer and use it in GitHub Desktop.
Save savonarola/179950 to your computer and use it in GitHub Desktop.
st = gets.chomp
w = st.dup
correct = true
l = st.length
i=0
while i<l
if w[i..i]=='z'
w[i..i]='T'
else
if (w[i..i] != 'a')and(w[i..i] !='b')
correct=false
end
end
i=i+1
end
if not correct
puts 'Izn\'t correct simbols'
else
w_old=w.dup
while w.length>1
w=w.gsub('aT','T')
w=w.gsub('bTT','T')
if(w==w_old)
w='N'
end
w_old=w.dup
end
if w=='T'
puts st+' - corret word'
else
puts st+' - uncorrect word'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment