Skip to content

Commit f6e5b24

Browse files
committed
Added my all coding assignments
1 parent 9386085 commit f6e5b24

5 files changed

Lines changed: 77 additions & 0 deletions

File tree

funny-string/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/CDC-1.1%Foundation-1.1"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

funny-string/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>funny-string</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.4
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
11+
org.eclipse.jdt.core.compiler.source=1.3

funny-string/bin/Solution.class

1.54 KB
Binary file not shown.

funny-string/src/Solution.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import java.io.*;
2+
import java.util.*;
3+
import java.text.*;
4+
import java.math.*;
5+
import java.util.regex.*;
6+
7+
public class Solution {
8+
9+
public static void main(String[] args) {
10+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
11+
Scanner sc=new Scanner(System.in);
12+
int t= sc.nextInt();
13+
int[] res=new int[t+1];
14+
// Setting result values to zero
15+
for(int i=0;i<=t;i++){
16+
res[i]=0;
17+
}
18+
for(int i=0;i<=t;i++){
19+
20+
String s=sc.nextLine();
21+
String r=new StringBuilder(s).reverse().toString();
22+
for(int j=1;j<s.length();j++){
23+
int test=Math.abs(s.charAt(j)-s.charAt(j-1));
24+
int test1=Math.abs(r.charAt(j)-r.charAt(j-1));
25+
if(test!=test1){
26+
res[i]=1;
27+
break;
28+
}
29+
}
30+
}
31+
32+
for(int i=1;i<=t;i++){
33+
if(res[i]==0){
34+
System.out.println("Funny");
35+
}
36+
else{
37+
System.out.println("Not Funny");
38+
}
39+
}
40+
System.out.println("Arry zero o/p="+res[0]);
41+
sc.close();
42+
}
43+
}

0 commit comments

Comments
 (0)