- Notifications
You must be signed in to change notification settings - Fork 366
/
Copy pathis_pali.cpp
29 lines (27 loc) · 516 Bytes
/
is_pali.cpp
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
#include<bits/stdc++.h>
usingnamespacestd;
#definelllonglong
#definepb push_back
#definemod1000000007
#defineendl'\n'
boolisPalindrome(char s[],int i,int n){
if(i>=n/2)
returntrue;
if(s[i]!=s[n-i-1])
returnfalse;
returnisPalindrome(s,i+1,n);
}
intmain(){
cin.tie(0)->sync_with_stdio(0);
int n;cin>>n;
char str[n];
for (int i = 0; i < n; ++i)
{
cin>>str[i];
}
if(isPalindrome(str,0,n))
cout<<"its a palli"<<endl;
else
cout<<"its not palli "<<endl;
return0;
}