How can if find the most repeated character and number ???

Hi,
I have a question. For instance, if we have a text file which contains:
aaabbbhhhhhhtttttsjs12366
How can i find the most repeated character and number. I have to add this code to the following program:
I will aprreciate if you can help.
Regards,
Serkan
import java.io.*;
public class LineLen {
     public static void main(String args[]) throws Throwable {
          final String filename = "deneme1.txt";
          BufferedReader infile = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
          String line = infile.readLine();
          int linenum = 0;
          while (line != null) {
               int len = line.length();
               linenum++;
               System.out.print(linenum + "\t");
               for (int i = 0; i<len; i++)
               System.out.print("*");
               System.out.println("");
               line = infile.readLine();
}

For a small alphabet like English, array migt be used:
//in a for loop
++array[s.charAt(i)];For a big alphabet like chinese, HashMap might be barely used:
map.put(s.charAt(i), increment(map.get(s.charAt(i))));
// increment is a user defined method, possibly for an Integer object,
// that returns a new Integer object

Similar Messages

  • How can we find the most usage and lowest usage of table in Sql Server by T-SQL

    how can we find the most usage and lowest usage of table in Sql Server by T-SQL
    The table has time stamp column
    StartedOn datetime
    EndedOn datetime

    The Below query has been used , but the textdata column doesnot include the name of the table ServiceLog.
    SELECT
    FROM
    databasename,
    duration
    fn_trace_gettable('F:\Program
    Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\log_148.trc',
    default)
    WHERE
    DATABASENAME='ZTCFUTURE'
    AND TEXTDATA
    IS
    NOT
    NULL
    --AND TEXTDATA LIKE 'SERVICE%'
    order
    by cpu
    desc; 

  • How can I find the specific channel name and modify channel name in automatically in VBS?

    How can I find the specific channel name and modify channel name in automatically in VBS? (DIAdem 9.1)
    I would like to change channel name = "speed01" ... "speed10"  to  channel name = "velocity01"..."velocity10.
    martino

    Hello Martino,
    this script will help:
    Option Explicit
    Dim i
    Dim n
    For i=1 To 10
    If i < 10 then
    n = CNo("speed0" & i)
    Else
    n = CNo("speed" & i)
    End If
    If n > 0 Then
    If i < 10 then
    ChnName(n) = "velocitiy0" & i
    Else
    ChnName(n) = "velocitiy" & i
    End If
    End If
    Next
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • How can i find the music itunes scanned and deleted from my ipod classic

    So I recently scanned my ipod classic for any problems and it decided to delete a whole bunch of my music.
    It also said something about putting the corrupted files in a "Found" Folder which i cannot find.
    Is there a way to get the music back somehow?

    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities
    or
    Recovering your iTunes library from your iPod or iOS device: Apple Support Communities

  • How can i find the year/specs of a laptop?

    I am planning on purchasing a macbook from a local shop and they say it is slightly used but are giving it to me for a substantially low price. They said they will allow me to check it out and see if i want to buy it or not. How can i find the year of purchase and specs of the laptop quickly and through simple use at the store to decided if i want to make the purchase? also, how can i judge if a mac is fully functioning in a short period of time? sorry for my lack of knowledge as i have only ever owned a pc

    When examining the laptop, boot it up, click the Apple menu, and click "About This Mac." It will tell you the CPU and RAM. Click the More Info button for the full System Information listing of all hardware and software.
    The System Information Hardware Overview section will list the exact model like this:
      Model Name:          MacBook Pro
      Model Identifier:          MacBookPro8,2
    You can look up the Model Identifier to determine the year of release and more specs. I have the MacTracker app on my iPhone which has a complete database of all Macs ever made, so I look it up there.
    On the desktop, if you select the hard disk icon and choose Get Info you will get a readout of the disk capacity and how much is used/free.
    It's hard to know if a Mac has a hidden problem, after only a few minutes of examination. You will have to wing it or ask for some kind of warranty.

  • How can I find the index from a specific container?

    How can I find the index from a specific container?
    For example, if I'm traversing through textframes like so (an example, not tested):
    var doc = app.activeDocument;
    var story = doc.pages[0].textFrames[0].parentStory;
    for (var i=0, l=story.textContainers.length; i<l; i++) {
         var textFrame = story.textContainers[i];
         if (textFrame.constructor.name == "TextFrame") {
              var lastPara = textFrame.paragraphs.lastItem();        //How can I find the index of this in relation to the story?
    How can I find the index of "lastPara" in relation to the story rather than the current container?
    I tried:
    var newPara = story.paragraphs[lastPara.index];
    but this results in an invalid object. . .
    alert(newPara.isValid);      //returns false

    The .index property is the character offset. So lastPara will begin at story.characters[lastPara.index].

  • How can I find the time a site was accessed in Safari's history?

    I know that Safari's "History" list is in reverse order, that is, most recently visited sites at the top of the list.  How can I find the time a particular site was visited?

    As of Safari 5.1.7 there does not appear to be a way to view the time in the browser, but it is still possbile to find from the raw history file. Open /Users/[yourusername]/library/Safari/History.plist in a text editor. Depending on how your text editor reads the file, you may see a lot of garbled text, but you should still be able to find the URL that you want the time for. After the URL you may see the page's title, but should also see a left square bracket followed by numbers.
    Example:
    _?http://www.apple.com/_Apple[377832904.6o
    The integer is an Apple timestamp (number of seconds since 00:00:00 UTC on 1 January 2001). Find a timestamp calculator online to get the actual time for your timestamp. In the example above, Apple was visited on Dec 21 2012 at 17:35:04 PST.
    Cheers.

  • How can i find the fields for &DOPOS_CPY-WRBT1(I13.0)&

    Hi All,
    In sapscripts, what is the meaning for (13.0)?
    how can i find the fields for &DOPOS_CPY-WRBT1(I13.0)&?
    Thanks.

    meaning for (13.0) is write to form this variable's 13 character non decimal and 0 character decimal places.
    shortly not write decimal places.
    DOPOS_CPY-WRBT1 is exist in form caller program. check in abap program not in sapscript.
    take care
    Çağatay

  • How can we find the hostname of the devices connected with the interfaces of switch?

    how can we find the hostname of the devices connected with the interfaces of switch ? I have tried mac address and ARP, there are lot of servers connected with the switch having multiples LAN cards. So mac table shows the mac of physical machine as well as virtual machines. But i want to know only the physical machines. Is there any other method to find out the IP address, hostname of the physical machines only? 

    Hello Leo Laohoo
    Thanks for this information
    In our network most of the Servers are not of Cisco. Some of them are Vmware machines, some are Hyper V machines, etc. 
    Does IP device tracking show us only the IP addresses of the Physical Machines of the Vmware Server not of Virtual Machines?
    Regards
    Mukesh Kumar
    Network Engineer 
    Spooster IT Services

  • Moving adobe 9 standard from 1 machine to another. How can I find the activation code on the old machine to activate on new machine

    moving adobe 9 standard from 1 machine to another. How can I find the activation code on the old machine to activate on new machine?

    You didn't really clarify much, just repeated the same question. First of all, Adobe is a company with many products.
    Are you talking about Adobe Acrobat? If so you need to deactivate it on the old machine and then use enter the serial-number (as described) when installing it on the new machine. It will then activate itself automatically over the internet. Just keep in mind that Acrobat 9 is not compatible with Windows 8 and to make it compatible with Windows 7 you have to update it to at least version 9.2 after the installation.

  • I am trying to download xfinity tv go app. I can not find it in my App Store and can not download it from the comcast website. All I get is a blank screen in the App Store. My Apple ID is associated with a Canadian address. How can I find the app?

    I am trying to download xfinity tv go app. I can not find it in my App Store and can not download it from the comcast website. All I get is a blank screen in the App Store. My Apple ID is associated with a Canadian address. How can I find the app?

    Its possible the App is not available in the Canadian store if the link doesn't work for you.
    https://itunes.apple.com/us/app/xfinity-connect/id320788270?mt=8

  • How can I find the URL for an iCal calendar in iCloud so I can make a link to it on a web page.

    I have a single iCal calendar that I want people to access through my webpage.  How can I find the URL so that they can view the calendar without having to subscribe to it.  I converted to iCloud from .Mac and I can see that changes to this calendar are not showing up.

    Mmmh.. i see... I don't know wether it is possible for people just check calendars without subscribing to them... I have been sharing some calendars in my website (maybe you can have a look at it in order to check wether it could be a possible solution for you)
      http://web.me.com/andreabruschi/englishplanet/English_Courses.html
    Cheers
    Andrea

  • How can I find the location of an app on my iPad 2?

    How can I find the location of an app on my iPad 2? The app comes up with a search, but that seems to be the only way to find it. I just installed the app today, but I can't figure out where it is. It has a pretty distinctive icon, and I've looked through all of my apps and even in folders (even though I don't know how it would have gotten there). I want to put it in an appropriate folder under the right subject, but I can't find it to do this. I can use the app, since I can find it through a search though. I have a lot of apps, but I looked very carefully and can't find it. Is there a way to ask my iPad to locate it for me? It's a $25 app and one I plan to use regularly, so I want it located in the folder of my choice.This problem makes we wonder if I have other "missing" apps, apps that I could  find if I happened to think to search for them, but that don't appear to be on my iPad (even though they actually  are).

    You were right about the homescreens. I had turned my iPad off for the night with less than three full homescreens of loose apps, those not in folders. When I turned the iPad on this morning to try your suggestions, I had five full pages of loose apps. They just appeared when I restarted, and there was the app I was looking for, easy to find. Last night I was deleting apps I decided I wouldn't use, organizing useful apps into folders, and making sure I had as few pages as needed by making sure the gaps made by the moved/deleted apps were closed. The missing apps didn't show up at that point; I was just left with fewer than 11 pages. The apps only showed up when I restarted this morning. There were almost three extra pages of apps that weren't there last night. I know there must be other things missing, since all of the pages are full. So I tried your suggestion in iTunes. I connected my iPad, found an app in the alphabetical list on the left, and double clicked it. This brought me to the app's homescreen (and its home folder when applicable), the place where it was located. In order to identify which page that was, I had to scroll through the screen shots of the homescreens that was below the homescreen that was showing until I found the homescreen whose number was in white. Then I could count the pages on my iPad until I got to that page. I'll have to delete more apps and organize more into folders to see what else might show up. There are just too many apps available for special education, and I'm in the process of figuring out which are the best for my needs. Thanks so much!

  • Hello! I have one iTunes library on my iPod and one iTunes library on my computer. When I connect my iPod touch to my PC, however, I cannot find any files in my iPod except for pictures. How can I find the music files so I can add them to my iTunes?

    Hello! I have one iTunes library on my iPod and one iTunes library on my computer. When I connect my iPod touch to my PC, however, I cannot find any files in my iPod except for pictures. How can I find the music files so I can add them to my iTunes?

    You can't do that.
    And before you decide to store any music that you own on a computer at work, talk to your IT department. Many organizations do not permit it for legal reasons. Standard policies are that anything stored on company owned computers is the property of the company. It could not be legally stored on their machines unless you transfer the licenses and all copies, physical and digital, to the company, meaning you no longer own the music. If they were to be audited and could not prove that they own the music, they would be subject to copyright violation penalties. Just use your iPod when you're at the office if you want to listen to music.

  • How can I find the serial number for my creative suite CS6 I bought it from a store.

    How can I find the serial number for my creative suite CS6 I bought it from a store.

    https://www.adobe.com/account.html for serial numbers or subscriptions on your Adobe page... or
    Lost serial # http://helpx.adobe.com/x-productkb/global/find-serial-number.html

Maybe you are looking for

  • Average & SUM in a Single criteria in the Pivot View

    Hi, Can you plese let me know whether it is possible to have SUM at the Grand Total level & Average on the Right Hand side of the Pivot Table view at the same time. Thanks & Regards Siva.

  • Install problem on Windows 7 64-bit

    Hello all, I am attempting to install Adobe Reader on a new installation of Windows 7 64-bit.  When I run the setup file (AdbeRdr920_en_US.exe) the installer starts, but the progress bar never gets beyond 10.93%. It just hangs there.  The text above

  • Refresh two regions at a time

    Hi, Iam new to ADF Framework. Using JDeveloper 11.1.1.5.0. Following is the high level description of our requirement. I've JSF page with four regions localted at left,Center, Bottom & Right. Left region having three buttons. Based on button click, c

  • 'Your system has run out of application memory'?!

    I've seen many users experiencing this same problem throughout the community, but none of the fixes have given me a permanent solution. Details of the machine are below, as well as what happens when the problem hits/triggers. MBP Retina running OS X

  • I really, really miss "File-Save As..."

    After upgrading to Mac OS X v10.7 Lion I find that the only way to do a "Save As..." of a document is to "browse all verisions", Restore, Duplicate, then select Save of the copied file, and select "Save As" in the dialog box that appears. That is WAY