We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 86a1306 commit dbd5ab7Copy full SHA for dbd5ab7
Strings/ConvertToPalindrome_Strings.cpp
@@ -0,0 +1,34 @@
1
+# include<bits/stdc++.h>
2
+using namespace std;
3
+
4
+int main()
5
+{
6
+ string A;
7
+ cin>>A;
8
+ int n = A.size();
9
+ int i=0, j=n-1, count=0;
10
+ while(i<j)
11
+ {
12
+ if(A[i]==A[j])
13
14
+ i++;
15
+ j--;
16
+ }
17
+ else if(A[i+1]==A[j] && count == 0)
18
19
+ count++;
20
21
22
+ else if(A[i]==A[j-1] && count == 0)
23
24
25
26
27
+ else break;
28
29
+ if(i<j)
30
+ cout<<"0"<<endl;
31
+ else
32
+ cout<<"1"<<endl;
33
+}
34
0 commit comments