fork download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. System.out.println(encode(WWWWWWWWWBBBWWW));
  9. }
  10. private static String encode(String input){
  11. char c='\0';
  12. char[] chars=input.charArray();
  13. String output="";int runLength=0;
  14. for(int i=0;i<chars.length;i++){
  15. if(c==chars[i]){
  16. runLength++;
  17. }else{
  18. output+=runLength+c;
  19. runLength=0;c='\0';
  20. }
  21. }
  22.  
  23. }
  24. //private static String decode(String output){
  25. //}
  26. }
Runtime error #stdin #stdout 0.68s 217280KB
stdin
Standard input is empty
stdout
Standard output is empty