CSES - Datatähti 2017 alku - Results
Submission details
Task:Pakkaus
Sender:sp
Submission time:2016-10-04 22:48:02 +0300
Language:Java
Status:COMPILE ERROR

Compiler report

input/Compresio12n.java:51: error: class, interface, or enum expected
       int h1=d[0+1].length();
       ^
input/Compresio12n.java:53: error: class, interface, or enum expected
         c=c.substring(h1);
         ^
input/Compresio12n.java:56: error: class, interface, or enum expected
       nb2 =c.length();
       ^
input/Compresio12n.java:58: error: class, interface, or enum expected
  }
  ^
input/Compresio12n.java:60: error: class, interface, or enum expected
    }
    ^
5 errors

Code

import java.util.Scanner;
/**
*
* @author Miro Petsalo
*/
public class Compresio12n {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
String c = s.nextLine();
int nb2 =c.length();
String answer ="";
while (nb2>0) {
int i=0;
String d[] = c.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
int h=d[i].length();
int x = Integer.parseInt(d[0]);
c=c.substring(h);
while(x>0){
answer = answer+d[i+1];
x=x-1;
}
int h1=d[i+1].length();
c=c.substring(h1);
nb2 =c.length();
}
System.out.println(answer);
}
}
int h1=d[0+1].length();
c=c.substring(h1);
nb2 =c.length();
}
System.out.println(answer);
}
}