@@ -0,0 +1,1140 @@
+package ru.job4j.concurrency.threads;%0A%0Aimport java.util.StringTokenizer;%0A%0Apublic class AsyncOperations %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        String str = %22This is a string to operate.%22;%0A        new Thread() %7B%0A            @Override%0A            public void run() %7B%0A                char%5B%5D arr = str.toCharArray();%0A                int countSpaces = 0;%0A                for (int i = 0; i %3C arr.length; i++) %7B%0A                    if (arr%5Bi%5D == ' ') %7B%0A                        countSpaces++;%0A                    %7D%0A                %7D%0A                System.out.println(countSpaces);%0A            %7D%0A        %7D.start();%0A        new Thread() %7B%0A            @Override%0A            public void run() %7B%0A                int countWords = 0;%0A                for(int e = 0; e %3C str.length(); e++)%7B%0A                    if(str.charAt(e) != ' ')%7B%0A                        countWords++;%0A                        while(str.charAt(e) != ' ' && e %3C str.length()-1)%7B%0A                            e++;%0A                        %7D%0A                    %7D%0A                %7D%0A                System.out.println(countWords);%0A            %7D%0A        %7D.start();%0A%0A%0A    %7D%0A%7D%0A

task Count words and spaces in a string #1016