-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCC.java
More file actions
25 lines (24 loc) · 743 Bytes
/
CC.java
File metadata and controls
25 lines (24 loc) · 743 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
import java.util.Scanner;
public class CC {
public static void main(String []argh){
Scanner in = new Scanner(System.in);
String s = in.nextLine();
int k = in.nextInt();
int c=s.length();
int count=0;
for(int i=0;i<s.length()/2;i++){
if(s.charAt(i)==s.charAt(c-1)){
count++;
}
c--;
}
if(s.length()==4){
if((count==s.length()/2 && k==1)||((count!=s.length()/2 && k!=1)||(count!=s.length()/2 && k==1)))
{
System.out.println("YES");
} else System.out.println("NO");
} else if(k!=1){
System.out.println("YES");
} else System.out.println("NO");
}
}