SHARE
TWEET

Untitled

a guest Dec 8th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import java.util.*;
  3. import java.util.stream.*;
  4.  
  5. public class Test{
  6.     public static void main(String[] args){
  7.         final Random r = new Random();
  8.        
  9.        
  10.         ArrayList<String> s = new ArrayList<>();
  11.         ArrayList<String> merkit = new ArrayList<>(Arrays.asList("qwertyuipasdfghjklzxcvbnm".split("")));
  12.        
  13.         for(int i=0; i< 6+r.nextInt(12); i++){
  14.             s.add(merkit.remove(r.nextInt(merkit.size())));
  15.         }
  16.        
  17.         for(int i=0; i< 20; i++){
  18.             int indeksi = Math.max(0,r.nextInt(s.size()-2));
  19.            
  20.             s.add(indeksi+2,s.get(indeksi));
  21.         }
  22.        
  23.         String mjono = s.stream().collect(Collectors.joining());
  24.         System.out.println(""+mjono);
  25.         laskeMerkit(mjono);
  26.     }
  27.  
  28. //MUN KOODI
  29. public static void laskeMerkit(string s){
  30.     String iso="ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ";
  31.     String pieni="abcdefghijklmnopqrstuvwxyzåäö";
  32.     int temp=0;
  33.    
  34.     for(int j=0; j<iso.length(); j++){
  35.         temp=0;
  36.         for(int i=0; i<s.length(); i++){
  37.             if(iso.charAt(j)==s.charAt(i)){
  38.                 temp+=1;
  39.             }
  40.         }
  41.         System.out.println(iso.charAt(j) + ":" + temp);
  42.     }
  43. }  
  44.  
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top