Advertisement
Guest User

Untitled

a guest
Feb 24th, 2022
141
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class ElmessTwo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7.  
  8. String bord = scanner.nextLine();
  9. int first = 0;
  10. int sec = 0;
  11.  
  12. String bord1 = bord.replace(" ", "");
  13. for (int i = 0; i < bord1.length() - 1; i++) {
  14.  
  15. if(Character.isLetter(bord1.charAt(i)) || Character.isDigit(bord1.charAt(i))){
  16. first = 0;
  17. }else {
  18. first = first + 1 ;
  19.  
  20.  
  21. }
  22. if (first > sec ){
  23. sec = first;
  24. }
  25. }
  26.  
  27.  
  28. System.out.println(sec);
  29.  
  30. }
  31. }
  32.  
Advertisement
RAW Paste Data Copied
Advertisement