Advertisement
roronoa

tall numbers

Jun 14th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. class Solution
  4. {
  5.  
  6.     public static void main(String args[])
  7.     {
  8.         Scanner in = new Scanner(System.in);
  9.         String n = in.nextLine();
  10.        
  11.         System.out.println(isTall(n)?true:false);
  12.     }
  13.    
  14.     public static boolean isTall(String n)
  15.     {
  16.         for(int i = 1; i < n.length(); i++)
  17.             if(n.charAt(i) < n.charAt(i-1))
  18.                 return false;
  19.         return true;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement