Question
Hi, I need assistance with this code. I am unsure what I did incorrectly, The lab is Word Frequencies. here is my code: import java.util.*;
Hi, I need assistance with this code.
I am unsure what I did incorrectly,
The lab is Word Frequencies. here is my code:
import java.util.*;
public class ReadWord
{
public static void main (String args[]){
int frequencies[]=new int[20];
Scanner sc=new Scanner(System.in);
String[] input=sc.nextLine().split(" ");
int n=Integer.parseInt(input[0]);
int count;
for(int i=1;i count=0; for(int j=0;j if(input[i].equals(input[j+1])){ count++; } } frequencies[i-1]=count; } for(int i=0;i System.out.println(input[i+1]+" "+frequencies[i]); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started