Problem: 'Is It You, Cody?' in Java | AskTheCode

Asked By: Crystal | Problem solving in Java | Problems related to Strings in Java | Ask The Code


Is It You, Cody? Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct.

Now, will you take on this task?

Input Sample:

c O D y

Output Sample:



import java.util.Scanner;

public class solution_IIY_Cody{

public static void main(String[] args) {

Scanner sc = new Scanner(;

String a =;

String b =;

String c =;

String d =;

a = a+b+c+d;

String s = "cody";

if (a.toLowerCase().equals(s)) {








89 views0 comments

Recent Posts

See All

Golf CodeChef Solution in Java - AskTheCode

CodeChef May Long Challenge Solution | Golf (LKDNGOLF) solution | AskTheCode Golf (LKDNGOLF) solution Problem: It's a lockdown. You’re bored in your house and are playing golf in the hallway. The hall

Solubility - CodeChef Solution in Java and C++| AskTheCode

CodeChef May Long Challenge Solution | Solubility (SOLBLTY) solution | AskTheCode Solubility (SOLBLTY) solution Problem: Suppose for a unit rise in temperature, the solubility of sugar in water increa

Valid Paths CodeChef Solution in C++ | AskTheCode

CodeChef May Long Challenge Solution | Valid Paths (VPATH) solution | AskTheCode Valid Paths (VPATH) CodeChef solution Problem: You are given a tree with N nodes numbered from 1 to N. A set S of nodes