Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8116755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:55:46+00:00 2026-06-06T03:55:46+00:00

I am new here, but I am having hard time figuring out how to

  • 0

I am new here, but I am having hard time figuring out how to write a code to determine an input of word and see if the first is matching with the end of the word. You may input abba and get answer it’s evenly symmetric and aba is oddly symmetric.

Please show me how:(

Just two main things.

first
I want to know if it’s oddly or evenly amount of letter(number of letter divided by 2,if it’s ending with 0.5, it’s oddly symmetric,
if is an integer it’s evenly symmetric.

second
I want to get (i.e 1=n,2=n-1,3=n-2…) position of the letter in the word to be the main idea of the execution.If there is a last letter in the oddly symmetric word, ignore the last remaining letter.

I appreciate any headstart or idea:) Thanks!

Thanks KDiTraglia, I made the code and compiled and here is what I put. I am not getting any further.

Reported problem:

Exception in thread “main” java.lang.Error: Unresolved compilation problems:
reverse cannot be resolved or is not a field
reverse cannot be resolved or is not a field
Syntax error, insert “) Statement” to complete IfStatement

This is what i got from, KDiTraglia’s help

public class WordSymmetric {
public static void main(String[] args) {
 String word = "abccdccba";


if ( (word.length() % 2) == 1 ) {
    System.out.println("They are oddly symmetric");
    //odd
}
else {
    System.out.println("They are evenly symmetric");
    //even
}

int halfLength = word.length() / 2;
String firstHalf = word.substring(0, halfLength);
String secondHalf = word.substring(halfLength, word.length());

System.out.println(secondHalf.reverse());

if (firstHalf.equals(secondHalf.reverse()) {
    System.out.println("They match");
    //they match
} 

}
}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:55:47+00:00Added an answer on June 6, 2026 at 3:55 am

    You can use the modulo operator to determine whether the word has an even or odd number of letters (% in java)

    if ( (word.length % 2) == 1 ) {
        //odd
    }
    else {
        //even
    }
    

    then just split the string in half and compare the reverse of the end with the front

    int halfLength = word.length / 2;
    String firstHalf = word.substring(0, halfLength);
    String secondHalf = word.substring(halfLength, word.length);
    if (firstHalf.equals(secondHalf.reverse()) {
        //they match
    }
    

    something like this should work, I just wrote it up real quick, might need to make a few changes to match java syntax.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Programming java to determine a symmetrical word am new here, but I
I'm having a hard time figuring out where the problem is coming from, so
I'm having a hard time figuring out how to work with the two string
I'm having a hard time figuring out how to pass by reference in Java.
Ok, I have been having a VERY hard time figuring this out. I guess
I'm having a hard time figuring out how to implement a factory pattern in
Here is my code: <%= Html.TextBox(txtId, new { @readonly = readonly })%> But it's
I'm taking an operating systems course and I'm having a hard time how input
I've been having a hard time trying to append new headers to tables I
I'm having a hard time understanding why this.$map and this.markers are undefined. Here's the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.