forked from srinathr91/TestJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
43 lines (39 loc) · 1.05 KB
/
Solution.java
File metadata and controls
43 lines (39 loc) · 1.05 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc=new Scanner(System.in);
int t= sc.nextInt();
int[] res=new int[t+1];
// Setting result values to zero
for(int i=0;i<=t;i++){
res[i]=0;
}
for(int i=0;i<=t;i++){
String s=sc.nextLine();
String r=new StringBuilder(s).reverse().toString();
for(int j=1;j<s.length();j++){
int test=Math.abs(s.charAt(j)-s.charAt(j-1));
int test1=Math.abs(r.charAt(j)-r.charAt(j-1));
if(test!=test1){
res[i]=1;
break;
}
}
}
for(int i=1;i<=t;i++){
if(res[i]==0){
System.out.println("Funny");
}
else{
System.out.println("Not Funny");
}
}
System.out.println("Arry zero o/p="+res[0]);
sc.close();
}
}