Mayank and strings

3.1

15 votes
Problem

Bob is learing string manipulation. Today his teacher gives him a string of characters strictly between 'a'-'z' and asks him whether the given string is good or not. A string is said to be good if the number of pairs of consecutive letters having positive difference less than or equal to 5 is four or more.

input
It consist of an integer t and the next t lines each contains string having elements strictly between 'a'-'z'.

output
print "good" without quotes if the condition is true print "not good" without quotes if the condition is false

Constraints
1<=t<=10
1<=N<=10^5

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?