Question 7 (DS)

There is a list of 20 words. 10 of them are good works, and 10 of them are bad words. Write a regex of not more than 25 characters which would tell if given word is good or bad. Input would only contain one of these 20 words.

Good words: papa, book, home, cars, jolly, sugar, friend, mother, father, bloomiest

Bad words: ache, slow, torn, slum, boom, rival, wrong, cholera, revenge, arrogant

Input: book

Output: Good

Input: boom

Output: bad

Write Java Code using regex pattern

[advanced_iframe securitykey=”undefined” src=”https://ide.kodnest.com/?tgp0″ width=”100%” height=”600″]

KodNest Training New Batch is starting on 21st September 2020. Attend one week free demo classes.Register Now

New Report

Close