| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:WAIn Reply To:WA Posted by:paradox12 at 2014-08-05 19:07:36 I have the same issue, I am using JAVA. Did you discover the problem?
Thats my code:
import java.util.*;
public class Main{
public static void main(String[] argc){
Scanner input = new Scanner(System.in);
String[] str = new String[4];
char[] chr = new char[26];
int[] counter = new int[26];
char chr_temp;
for(String s: str){
s = input.nextLine();
for(int c = 0; c < s.length(); c++){
chr_temp = s.charAt(c);
if((chr_temp >= 'A') && (chr_temp <= 'z')){
chr[chr_temp-65] = chr_temp;
counter[chr_temp - 65]++;
}
}
}
int max = 0;
for(int i: counter){
if(i > max)
max = i;
}
int l =0;
while (max > 0){
for(int i: counter){
l++;
if(l == 25 && i >= max)
System.out.print("*");
else if(l == 25 && i < max)
System.out.print(" ");
else if(i >= max)
System.out.print("* ");
else System.out.print(" ");
}
System.out.println();
max--;
}
for(char c: chr){
if(c == chr[25])
System.out.print(c);
else System.out.print(c +" ");
}
System.out.println();
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator