Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String word = "Today is good day for test. Sun is shining. The students are happy. The birds are blue.";
- String[] split = word.split("\\.");
- char ch;
- int counter = 0;
- for (int i = 0; i< word.length(); i++){
- ch = word.charAt(i);
- int asciivalue = (int)ch;
- if(asciivalue >=65 && asciivalue <=90){ // tuka sravnqvam vsichki bukvi ot array-a s glavnite bukvi ot ASCII tablicata
- counter++;
- }
- }
- int maxLenght = 0;
- String result = " ";
- for (int i = 0; i <= split.length - 1; i++){
- if (maxLenght < split[i].length()){
- maxLenght = split[i].length();
- result = split[i];
- }
- // System.out.println(split[i]);
- }
- System.out.println(result);
- System.out.println(counter + " sentences in the text.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement