Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.*;
- public class Solution {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.println("===Первое заданиие===");
- System.out.println("Enter word:");
- String qwe = in.next();
- int l = qwe.length();
- ArrayList<String> asd = new ArrayList<String>();
- while (asd.size() != (int) (Math.pow(l, l))) {
- String z = "";
- for (int j = 0; j < l; j++) {
- z += qwe.charAt(0 + (int) (Math.random() * l));
- }
- if (asd.contains(z)) continue;
- else asd.add(z);
- }
- for (String x : asd) {
- System.out.println(x);
- }
- System.out.println("===Второе заданиие===");
- String y = in.nextLine();
- String[] e = y.split(" ");
- for (int i = e.length - 1; i >= 0; i--) {
- System.out.print(e[i] + " ");
- }
- System.out.println("===Третье заданиие===");
- HashSet<Character> v = new HashSet<Character>();
- String r = in.nextLine();
- char[] a = r.toCharArray();
- for (char i : a) {
- v.add(i);
- }
- for (char i : v) {
- System.out.print(i);
- }
- System.out.println("===Четвертое заданиие===");
- int[] sd = {1, 2, 3, 4, 43, 34, 5, 134, 43, 62, 3, 3};
- Arrays.sort(sd);
- for (int i : sd) {
- System.out.println(i);
- }
- System.out.println("===Пятое заданиие===");
- Map map = new HashMap();
- map.put(1, "один");
- map.put(2, "два");
- map.put(3, "три");
- int sum = 0;
- for (Object i : map.keySet()) {
- sum += Integer.parseInt(i.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement