-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringWithNumber.java
More file actions
29 lines (27 loc) · 947 Bytes
/
StringWithNumber.java
File metadata and controls
29 lines (27 loc) · 947 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
/**
* Created by MalhotR1 on 04/20/2017.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class StringWithNumber {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(br.readLine().trim());
for (int t = 0; t < T; t++) {
char[] in = br.readLine().trim().toLowerCase().toCharArray();
int length = 0;
int number = 0;
int k = 0;
for (int i = in.length - 1; i >= 0; i--) {
if (in[i] >= 97 && in[i] <= 122) break;
else {
number += (int) (in[i] - 48) * Math.pow(10, k);
k++;
}
}
if (number == in.length - k) System.out.println(1);
else System.out.println(0);
}
}
}