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 8910931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:49:12+00:00 2026-06-15T03:49:12+00:00

I have a program which will prompt the user for 9 characters. Once these

  • 0

I have a program which will prompt the user for 9 characters. Once these characters are in the program the program should create the longest word possible using these letters by comparing them against a dictionary file.

The program currently stores the 9 letters and reads in the dictionary file, but i have no idea where to start regarding the word creation.

All i need help with is the word creator. If someone knows how to create words from characters in an array can you give me a hand

  • 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-15T03:49:13+00:00Added an answer on June 15, 2026 at 3:49 am

    Cause it seems like you don´t get the solution, here is mine, it should be working

    import java.util.ArrayList;
    
    
    public class Test{
    public String[] dict = new String[] {"hi","das","bad","fenster","esel","bahi","tfshi"};
    public char[] input = new char[]{'a','b','d','h','i','s','f','t'};
    public String longestString = dict[0];
    
    public Test() {
        System.out.println(longestString);
        ArrayList<String> convert = new ArrayList<String>();
        for(String counter : dict)
            convert.add(counter);
        getInstance(convert, 0, input.length, 0, 0);
        System.out.println("\n\n\n" + longestString);
    
    
    }
    
    
    private void getInstance(ArrayList<String> searching, int pos, int length, int starter, int currentI) {
            int i = starter;
            do{
    
                ArrayList<String> matched = new ArrayList<String>();
                for(String counter : searching) {
                    if(counter.length() > pos) {
                        if(counter.charAt(pos) == input[i]){
                            matched.add(counter);
                        }
                    }
                }
                if(matched.size() > 0) {
                    getInstance(matched, pos+1,length,(i+1)%length, i%length);
                }
                else if(currentI != i && matched.size() > 0) {
                    getInstance(searching,pos,length,(i+1)%length, i%length);
                }
                if(matched.size() > 0 && longestString.length() < matched.get(0).length()){
                    longestString = searching.get(0);
                }
                ++i;
                i %= length;
            }while(i != currentI);
    }
    
    
    
    public static void main(String[] args) {
        new Test();
    
    }
    }
    

    EDIT: you should fix it a bit, i just found a mistake in there

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

Sidebar

Related Questions

I have a simple java GUI application, which will prompt a user for a
How to write a java program which will tell me whether I have internet
I have a C++ program which, during execution, will allocate about 3-8Gb of memory
I have a program which doesn't once reference System.I0, coded in vb.net, yet for
Making a simple program which will generate a multiple choice form. I have an
I am writing a program which will preform texture synthesis. I have been away
I was writing a command line program which will have a status bar, much
I have a program which creates JButtons which are then added to a JPanel
I have a program which dynamically generates a GUI. I don't know how many
I have a program which outputs a pair of words surrounded by spaces on

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.