Created
December 24, 2015 07:23
-
-
Save asanand3/2540123600d350b2def7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ReadChars { | |
| public static void main(String[] args) { | |
| Scanner scanner = new Scanner(System.in); | |
| String text = scanner.nextLine(); | |
| for (int i = 0; i < text.length(); ) { | |
| int temp = 0; | |
| for (int j = 0; j < text.length(); j++) { | |
| char a = text.charAt(i); | |
| if (String.valueOf(a).toUpperCase().equals(String.valueOf(text.charAt(j)).toUpperCase())) { | |
| temp++; | |
| } | |
| } | |
| System.out.println(text.charAt(i) + " " + String.valueOf(temp)); | |
| temp = 0; | |
| text= text.toUpperCase().replace(""+text.toUpperCase().charAt(i), ""); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment