-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLucky.java
More file actions
30 lines (29 loc) · 684 Bytes
/
Lucky.java
File metadata and controls
30 lines (29 loc) · 684 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.Scanner;
public class Lucky {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0)
{
String s=sc.next();
int sum1=0,sum2=0;
for(int i=0;i<=2;i++)
{
sum1+=s.charAt(i)-'0';
}
for(int i=3;i<=5;i++)
{
sum2+=s.charAt(i)-'0';
}
if(sum1==sum2)
{
System.out.println("YES");
}
else
{
System.out.println("NO");
}
}
sc.close();
}
}