Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- int count = 1;
- String str = "Привет,пидорас,ебаный ублюдок, хуесос,чертяга,лети к хуям";
- for(int i = 0;i<str.length();i++){
- if(str.substring(i, i+1).contains(" ")){
- count++;
- }if(str.charAt(i)==','&&str.charAt(i+1)!=' '){
- str.substring(i,i+1).equals(", ");
- count++;
- }
- }
- System.out.println("Количеств слов в строке равно "+count);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement