Advertisement
Guest User

Untitled

a guest
Mar 24th, 2016
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public static void main(String[] args) {
  2. int count = 1;
  3. String str = "Привет,пидорас,ебаный ублюдок, хуесос,чертяга,лети к хуям";
  4. for(int i = 0;i<str.length();i++){
  5. if(str.substring(i, i+1).contains(" ")){
  6. count++;
  7. }if(str.charAt(i)==','&&str.charAt(i+1)!=' '){
  8. str.substring(i,i+1).equals(", ");
  9. count++;
  10. }
  11. }
  12. System.out.println("Количеств слов в строке равно "+count);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement