code //#include<bits/stdc++.h>#include<iostream>#include<cstdio>#include<ctime>#include<cctype>#include<queue>#include<deque>#include<stack>#include<iostream>#include<iomanip>#include<cstdio>#include<cstring>#include<string>#include<ctime>#include<cmath>#include<cctype>#include<cstdlib>#include<...
#include<cmath> #include<set> #include<cstdlib> #include<cstring> #include<stack> #include<string> using namespace std; //freopen("C://i.txt","r",stdin); char s[11111]; int n; char rs[11111]; int a[10000],b[10000]; int main() { freopen("C://i.txt","r",stdin); int ...
1#include<iostream>2#include<algorithm>3#include<cstring>4#include<cstdio>5#include<vector>6#include<stack>7#include<queue>8#include<cmath>9#include10#include<set>11usingnamespacestd;12typedeflonglongll;13typedef pair<int,int>pll;14constintINF =0x3f3f3f3f;15constintmaxn=2000+5;1617intn;...
int i,*x=t,*y=t2; for (int i=0; i<m; i++) c[i]=0; for (int i=0; i<n; i++) c[x[i]=s[i]]++; for (int i=1; i<m; i++) c[i]+=c[i-1]; for (int i=n-1; i>=0; i--) sa[--c[x[i]]]=i; for (int k=1; k<=n; k<<=1) { int p=0; fo...
using System;using System.Linq;namespace palindrome{class Program{publicstaticboolcheckPalindrome(string mainString){string firstHalf=mainString.Substring(0,mainString.Length/2);char[]arr=mainString.ToCharArray();Array.Reverse(arr);string temp=newstring(arr);string secondHalf=temp.Substring(0,temp.Len...
Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics...
Palindrome Check Using Manual Approach# Python program to check if a string is # palindrome or not # function to check palindrome string def isPalindrome(string): result = True str_len = len(string) half_len= int(str_len/2) for i in range(0, half_len): # you need to check only ...
#include<cstdio> #include<string> #include<ctime> #include<cmath> #include<cstring> #include<algorithm> #include<stack> #include<climits> #include<queue> #include #include<set> #include<sstream> #include<cassert> #include<bitset> using namespace std; typedef long long LL; typedef unsigned ...
With all due respect to solutions offered, the solutions offered here are naive (naive in the sense of something that someone unfamiliar with computer science algorithms would think of). The most optimal solution will most probably be implemented using a dynamic programming approach (at the risk ...
each of which is either 'a', 'b' or 'c', with nopalindromes of length3 appearing in the string as a substring. For example, the strings "abc" and "abca" suit him, while the string "aba" doesn't. He also want the number of letters 'c' in his string to be as little as pos...