fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. class M{
  5. static String c(String i){
  6. Random r = new Random();
  7. int x = r.nextInt(2),
  8. j = r.nextInt(i.length());
  9. return x < 1
  10. ? i : i.substring(0, j - (x%2 ^ 1)) + (x<2?i.charAt(j):"") + i.substring(j);
  11. }
  12.  
  13. public static void main(String[] a){
  14. for(int i = 0; i < 5; i++){
  15. System.out.println(c("foo"));
  16. }
  17. System.out.println();
  18. for(int i = 0; i < 5; i++){
  19. System.out.println(c("PPCG"));
  20. }
  21. }
  22. }
Success #stdin #stdout 0.04s 320576KB
stdin
Standard input is empty
stdout
ffoo
foo
foo
foo
foo

PPCG
PPPCG
PPCG
PPPCG
PPCG