Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.lang.String;
- import java.util.*;
- class test{
- public static int Search(String [] s, String toFind,int size){
- for(int i = 0 ; i < size ; i++){
- if(s[i].equals(toFind)){
- return i;
- }
- }
- return -1;
- }
- public static void main(String [] arg){
- Scanner sc = new Scanner(System.in);
- String line = sc.nextLine();
- StringTokenizer TK = new StringTokenizer(line);
- int i = 0;
- String[] words = new String[50];
- int[] count = new int[50];
- while(TK.hasMoreTokens()){
- words[i]=TK.nextToken();
- count[i++]++;
- }
- for(int j = 0 ; j < i; j++){
- int s = Search(words,words[j],i);
- if(s!=-1)
- a[s]++;
- else
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement