回文时间

回文时间

import java.util.*;
class Time{
	int h;
	int m;
	Time(int h,int m){
		this.h=h;
		this.m=m;
	}
	public void next() {
		for(m++;;m++) {
			if(m==60) {
				h++;
				m=0;
				if(h==24) {
					h=0;
				}
			}
			if(h/10==m%10&&h%10==m/10) {
				System.out.printf("%02d:%02d\n",h,m);
				break;
			}
		}
	}
}
public class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()) {
			String str1=sc.nextLine();
			String[] str=str1.split(":");//将str1这个字符串用":"进行分割,分割后的字符存在str字符数组中
		    int H=Integer.parseInt(str[0]);
		    int M=Integer.parseInt(str[1]);
		    Time time=new Time(H,M);
		    time.next();
		}
		sc.close();
	}
}