본문내용
rintln(" " + string);
System.out.println();
if (isPalindrome(string)) {
System.out.println("Palindrome!");
} else {
System.out.println("NOT Palindrome!");
}
System.out.println();
}
}
public class Palindrome {
public static void main(String[] args) {
String s=args[0];
int i=0, j=s.length();
Palindrome p = new Palindrome();
p.isP(s,i,j);
}
public void isP(String s, int i, int j) {
if(i>=j)
scP(s,1);
if(s.charAt(i) == s.charAt(j))
isP(s,i+1,j-1);
scP(s,-1);
}
public void scP(String s, int f) {
if(f>0)
System.out.println(s + " 는 좌우 대칭인 문자 이다.");
System.out.println(s + " 는 좌우 대칭인 문자가 아니다.");
}
}
System.out.println();
if (isPalindrome(string)) {
System.out.println("Palindrome!");
} else {
System.out.println("NOT Palindrome!");
}
System.out.println();
}
}
public class Palindrome {
public static void main(String[] args) {
String s=args[0];
int i=0, j=s.length();
Palindrome p = new Palindrome();
p.isP(s,i,j);
}
public void isP(String s, int i, int j) {
if(i>=j)
scP(s,1);
if(s.charAt(i) == s.charAt(j))
isP(s,i+1,j-1);
scP(s,-1);
}
public void scP(String s, int f) {
if(f>0)
System.out.println(s + " 는 좌우 대칭인 문자 이다.");
System.out.println(s + " 는 좌우 대칭인 문자가 아니다.");
}
}
추천자료
[자료구조] max heap
[자료구조] BFS&DFS&BST
[자료구조] post&prefix
(자료구조) 큐를 이용한 환상형 연결리스트 삽입 & 삭제 소스
(자료구조) 스레드 이진트리 중위운행 결과 소스
(자료구조) 트리를 이용한 비순환적 중위운행 결과 소스
힙 자료구조를 이용한 상입,제거(특정 토큰에 대해)
리스트 자료구조를 이용한 상입,제거(특정 토큰에 대해)
[자료구조]Infix로 된 수식을 Prefix와 Postfix로 변환 시키는 프로그램입니다.(C언어)
철근 콘크리트 구조.PPT자료
연결리스트(자료구조).ppt
[자료구조] 피보나치수열 - int 데이타 사이즈를 넘어가는 결과값 계산 프로그램
C언어 자료구조 Binary Search Tree (이진 탐색 트리)
C언어 자료구조 HashTable 해시테이블
소개글