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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:32:23+00:00 2026-05-27T13:32:23+00:00

At input i have some string : today snowing know , here i have

  • 0

At input i have some string : “today snowing know ” , here i have 3 words , so i must to parse them is such way : every character i must compare with all other characters , and to sum how many same characters these words have , like exemple for “o” letter will be 2 (from “today” and “snowing”) or “w” letter will be 2 (from “know” and “snowing”). After that i must to replace these characters with number(transformed in char format) of letters. The result should be “13111 133211 1332”.

What i did ?

First i tape some words and

    public void inputStringsForThreads () {

       boolean flag;

            do {

    // will invite to input 
                stringToParse = Input.value();   

                try {

                flag = true;

    // in case that found nothing , space , number and other special character , throws an exception
                if (stringToParse.equals("") | stringToParse.startsWith(" ") | stringToParse.matches(".*[0-9].*") | stringToParse.matches(".*[~`!@#$%^&*()-+={};:',.<>?/'_].*"))

                    throw new MyStringException(stringToParse);

                else  analizeString(stringToParse);    
            }

            catch (MyStringException exception) {

                stringToParse = null;
                flag = false;
                exception.AnalizeException();  
            } 
          }
            while (!flag);
}

I eliminate spaces between words , and from those words make just one

   static void analizeString (String someString) {

// + sign treat many spaces as one
      String delimitator = " +";

// words is a String Array
      words = someString.split(delimitator);

// temp is a string , will contain a single word
      temp = someString.replaceAll("[^a-z^A-Z]","");


         System.out.println("=============== Words are : ===============");
      for (int i=0;i<words.length;i++)
          System.out.println((i+1)+")"+words[i]);
    }  

So i try to compare for every word in part (every word is split in letters) with all letter from all words , But i don know how to count number of same letter and after replace letters with correct number of each letter??? Any ideas ?

// this will containt characters for every word in part 
         char[] motot  =   words[id].toCharArray();

// this will containt all characters from all words     
         char[] notot = temp.toCharArray();


   for (int i =0;i<words[i].length();i++)

               for (int j=0;j<temp.length ;j++)

               {
                   if (i == j) {

                       System.out.println("Same word");

                   }

                   else   if (motot[i] == notot[j] ) {

                       System.out.println("Found equal :"+lol[i]+" "+lol1[j]);

                   }}
  • 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-05-27T13:32:23+00:00Added an answer on May 27, 2026 at 1:32 pm

    For counting you might want to use a Map<Character, Integer> counter like java.util.HashMap. If getting a Value(Integer) using a specific key (Character) from counter is ‘not null’, then your value++ (leverage autoboxing). Otherwise put a new entry (char, 1) in the counter.

    Replacing the letters with the numbers should be fairly easy then.

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

Sidebar

Related Questions

I have a string input = "maybe (this is | that was) some ((nice
hii all..i have some code that make all string characters which have been input
I'm no expert in regex but I need to parse some input I have
we have an input type=text user prints into it some string. each time he
I have some input string with characters and list of string. What I need
I think the problem is pretty common. You have some input string, and have
I have someone entering a form with some string input. What I need to
I have some code that takes an NSString as input and uses that string
I have some code to copy and paste: void WinClipboard::copy( const std::string& input )
We have some input data that sometimes appears with &nbsp characters on the end.

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.