package ru.job4j;


public class AsinClass {


    public static class Calculate implements Runnable {
        private String symbls;

        public Calculate(String symbls) {
            this.symbls = symbls;
        }

        @Override
        public void run() {
            String content = "Что и делать уж не знаю";
            String answ = "";
            int cntSpaces = 0, cntWords = 0;
            for (char sd : content.toCharArray()) {
                if (sd == ' ') {
                    if (this.symbls.equals("spcs")) {
                        cntSpaces++;
                    } else if (this.symbls.equals("words")) {
                        cntWords++;
                    }
                }
            }
            if (this.symbls.equals("spcs")) {
                answ = String.valueOf(cntSpaces);
            } else if (this.symbls.equals("words")) {
                answ = String.valueOf(++cntWords);
            }
            System.out.println(String.format("%s штук", symbls + ' ' + answ));
        }
    }

    public static void main(String[] args) {
        new Thread(new Calculate("spcs")).start();
        new Thread(new Calculate("words")).start();
    }

}

@@ -1076,22 +1076,202 @@
 args) %7B%0A
+%0A
       
+  Thread tStart = new Thread() %7B%0A            @Override%0A            public void run() %7B%0A                System.out.println(%22Start%22);%0A            %7D%0A        %7D;%0A        Thread tSpcs =
   new Th
@@ -1293,32 +1293,24 @@
 ate(%22spcs%22))
-.start()
 ;%0A        ne
@@ -1306,16 +1306,32 @@
 %0A       
+ Thread tWords =
  new Thr
@@ -1361,17 +1361,467 @@
 s%22))
-.start();
+;%0A        Thread tFinish = new Thread() %7B%0A            @Override%0A            public void run() %7B%0A                System.out.println(%22Finish%22);%0A            %7D%0A        %7D;%0A%0A        try %7B%0A            tStart.start();%0A            tStart.join();%0A            tSpcs.start();%0A            tWords.start();%0A            tSpcs.join();%0A            tWords.join();%0A            tFinish.start();%0A        %7D catch (InterruptedException e) %7B%0A            e.printStackTrace();%0A        %7D
 %0A   

task 1017