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. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. String one = "sambenwilearethebest";
  13. String two = "09876543210";
  14. String three = "02 13 97 68 45 0";
  15. System.out.println(one.length());
  16. System.out.println(two.length());
  17. System.out.println(three.length());
  18. System.out.println(one.charAt(0));
  19. System.out.println(one.charAt(1));
  20. System.out.println(one.charAt(one.length()-1));
  21. System.out.println(one.charAt(9));
  22. System.out.println(one.substring(0,4));
  23. System.out.println(one.substring(5));
  24. System.out.println(one.substring(9));
  25. System.out.println(one.substring(2,7));
  26. System.out.println(one.indexOf("abc"));
  27. System.out.println(one.indexOf("e"));
  28. System.out.println(one.indexOf("hij"));
  29. System.out.println(two.indexOf("54"));
  30. System.out.println(two.indexOf("24"));
  31. System.out.println(one.indexOf('w'));
  32. System.out.println(two.indexOf('b'));
  33. System.out.println(two.indexOf('s'));
  34. System.out.println(three.indexOf("45"));
  35.  
  36.  
  37. }
  38. }
Success #stdin #stdout 0.11s 47016KB
stdin
Standard input is empty
stdout
20
11
16
s
a
t
e
samb
nwilearethebest
earethebest
mbenw
-1
4
-1
5
-1
6
-1
-1
12