fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10.  
  11. public static String find()
  12. {
  13. String s="ACZa";
  14. String s2="CAZa";
  15. int l=s.length();
  16. int[] a=new int[l];
  17. for(int i=0;i<l;i++)
  18. {
  19. int c=(int)s.charAt(i);
  20. a[i]=c;
  21. }
  22. int c=0;
  23. for(int i=0;i<l;i++)
  24. {
  25. if(s.charAt(i)!=s2.charAt(i))
  26. {
  27. c++;
  28. }
  29. }
  30. String count=Integer.toString(c);
  31. String in="Increasing:"+count;
  32. String de="Decreasing:"+count;
  33. if(a[0]<a[1]&&a[1]<a[2]){
  34. return in;
  35. }
  36. else if(a[0]>a[1]&&a[1]>a[2])
  37. {
  38. return de;
  39. }
  40. return "Invalid";
  41. }
  42. public static void main (String[] args)
  43. {
  44. // your code goes here
  45. System.out.println(find());
  46.  
  47. }
  48. }
Success #stdin #stdout 0.12s 53796KB
stdin
Standard input is empty
stdout
Increasing:2