class Solution {
public int dayOfYear(String date) {
String[] strings = date.split("-");
int year = Integer.parseInt(strings[0]);
int m = Integer.parseInt(strings[1]);
int n = Integer.parseInt(strings[2]);
int[] month = {0,31,28,31,30,31,30,31,31,30,31,30,31};
if (year%40) {
if (year%1000) {
if (year%400==0) {
month[2]=29;
}
}
else month[2]=29;
}
int count = 0;
for (int i=0; i<m; i++) {
count += month[i];
}
count += n;
return count;
}
}