HI Everybody,
I 've to submit a program on c.Can any one help me
plz.........The problem is like this::
Write a program which computes the largest palindrome substring of a
string.
Input:
The input is the string whose largest palindrome substring should be
found.
Output:
The output displays the largest palindrome substring.
Sample Input:
Enter the string: Habitat
Sample Output:
The longest palindrome substring of Habitat is: tat 32 11407 ra************* **@gmail.com wrote:
[ Snip whole homework assignment written by a teacher who is clearly
better at non-d00d English than his pupils. ]
And your work so far is? Surely you don't expect us to do your homework
for you?
Richard
Richard Bos wrote:
ra************* **@gmail.com wrote:
[ Snip whole homework assignment written by a teacher who is clearly
better at non-d00d English than his pupils. ]
And your work so far is? Surely you don't expect us to do your homework
for you?
Richard
This really annoys me. As if there isn't enough incompetent IT
professionals out there...
<ra************ ***@gmail.comwr ote:
I 've to submit a program on c.Can any one help me
plz.........The problem is like this::
Write a program which computes the largest palindrome substring of a
string.
Input:
The input is the string whose largest palindrome substring should be
found.
Output:
The output displays the largest palindrome substring.
Sample Input:
Enter the string: Habitat
Sample Output:
The longest palindrome substring of Habitat is: tat
Note that the first letter of a palindrome is the same as the last letter.
Proceed from there.
HI Everybody,
>
I 've to submit a program on c.Can any one help me
plz.........The problem is like this::
Write a program which computes the largest palindrome substring of a
string.
Input:
The input is the string whose largest palindrome substring should be
found.
Output:
The output displays the largest palindrome substring.
Sample Input:
Enter the string: Habitat
Sample Output:
The longest palindrome substring of Habitat is: tat
I had this assignment a few years ago, got an A! Here's the exact code copy-
pasted. The code is perfect, fully-portable... just need to hand it in!
#include
"stdio.h"
#include
"string.h"
void main(int)
{
char[64] buffer;
scanf(STRING,bu ffer);
int * const p;
while
{
p = permute(buffer, buffer + len);
} do( p --p );
printf(p);
}
Hope that helps, always love to help out a fellow student : ) !
--
Frederick Gotham
On 2006-07-11, Frederick Gotham <fg*******@SPAM .comwrote:
I had this assignment a few years ago, got an A! Here's the exact code copy-
pasted. The code is perfect, fully-portable... just need to hand it in!
#include
"stdio.h"
#include
"string.h"
void main(int)
{
char[64] buffer;
scanf(STRING,bu ffer);
int * const p;
while
{
p = permute(buffer, buffer + len);
} do( p --p );
printf(p);
}
Hope that helps, always love to help out a fellow student : ) !
I laughed out loud at that one. :-)
--
Andrew Poelstra <http://www.wpsoftware. net/projects/>
To email me, use "apoelstra" at the above domain.
"You people hate mathematics." -- James Harris
Andrew Poelstra wrote:
>
On 2006-07-11, Frederick Gotham <fg*******@SPAM .comwrote:
I had this assignment a few years ago, got an A!
Here's the exact code copy-
pasted. The code is perfect, fully-portable...
just need to hand it in!
#include
"stdio.h"
#include
"string.h"
void main(int)
{
char[64] buffer;
scanf(STRING,bu ffer);
int * const p;
while
{
p = permute(buffer, buffer + len);
} do( p --p );
printf(p);
}
Hope that helps, always love to help out a fellow student : ) !
I laughed out loud at that one. :-)
Nobody is entitled to make any serious decisions
based on "code tested" and "code not tested" labels
on posted code.
Which is why
I'm not a fan of "code tested" and "code not tested" labels.
No criticism of Frederick Gotham is intended here.
--
pete
Andrew Poelstra wrote:
I laughed out loud at that one. :-)
I have written a function to identify a whole as palindromic or not. My
function knows this one is a palindrome:
A man, a plan, a canal - Panama!
To determine whether the following one is a palindrome will be more
difficult than the last one.
abcdefghijklmno pqrstuvwxyz0123 456789 A man, a plan, a canal - Panama!
(please do not laugh at the following function:), but comments are
welcome!)
/*palindrome.c*/
#include <stddef.h>
#include <string.h>
#include <ctype.h>
/*determine a sentence if it is a palindrome. s: the string to be
determined. return 1 for identifying a successful palindrome, 0 for
not. - jhl, Jul 2006*/
int palindrome(cons t char *s)
{
int pln = 1;
const char *left, *right;
if (s != NULL){
left = s;
right = s + strlen(s) - 1;
while (left < right){
if (!isalnum(*left )){
++left;
continue;
}
if (!isalnum(*righ t)){
--right;
continue;
}
if (toupper(*left) == *right || tolower(*left) == *right){
++left;
--right;
continue;
} else {
pln = 0; /*charaters occur mismatched, it is not palindrome*/
break;
}
}
}
return pln;
}
/* test */
#include <stdio.h>
int main()
{
printf("%d\n", palindrome("Mad am, I'm Adam!"));
printf("%d\n", palindrome("A man, a plan, a canal - Panama!"));
printf("%d\n", palindrome("Abl e was I, ere I saw Elba."));
printf("%d\n", palindrome("Ana voli Milovana"));
return 0;
}
$ cc -ansi -pedantic -Wall -W palindrome.c
$ ./a.out
1
1
1
1
$
lovecreatesbeau ty
lovecreatesbeau ty said:
Andrew Poelstra wrote:
>I laughed out loud at that one. :-)
I have written a function to identify a whole as palindromic or not.
Is it that time already? Here we go, then:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define p void
#define a sizeof
#define l char
#define i return
#define n int
#define d size_t
#define r if
#define o while
#define m else
#define e for
#define ob putchar
#define fu strlen
#define sc isalpha
#define at tolower
#define ed fgets
#define cp printf
#define ro strchr
#define gr main
#define am stdin
n c(l*s){n k=
0;r(s){d x
=fu (s)
;r(x>1)
{l*t=s,
*u=s+x-
1;k=1;o
(k&&t<u
){r(sc(
*t)){r(
sc(*u))
{r(at(
*t)!=at(
*u) ){k
=0; }m{
++t;--u;}}m{--
u;}}m{++t;}}}}
i k ;}n
gr( p){
l b [01
<<1 <<1
<<1
<<1
<<1
<<1
<<1
<<1
<<1
],*
z,*s=" adeil"
"mnoprst.\n ";
n f[]={00,01<<1
<<1,(1<<1<<1< <1
)|(
1<<
1)|
1},
v[]
={0
,(1<<1<<1)|(1<<
1)|1,1<<1<<1<<1
,(1 <<1
<<01 <<1
)|(01 <<1
<<1 )} ,q[
]={ (1 <<1
)&1 ,1 <<1
>>1 ,1 >>1
,(1 << 1<<
1<< 1) |1,
1<< 01<<1
>>1>>1,(1<<1
<<1 )|(
1<< 1>>
1), 1<<
1<< 1,(
1<< 1<<
1)| (01
<<1 )|1
,01 <<1
,(1<<1<<1<<1
)|(1<<01),1
<<1 <<1
<<1 ,(1
<<1 <<1
)|1 <<1
,(1 <<1
)|1,(1<<
1<< 1<<
1)| (01
<<1 <<1
)|1 ,(1
<<1 <<1
<<1)|(1<<
1<< 1)|
(01 <<1
)}; d y
;o( ed(
b,a (b)
,am )){
{z= ro(
b,1 *1*
'\n');}if(
z){ *z=
00;} {cp(
"%s", b);}e
(y=0;1 *y<a f
/a( 1[f ]); y++
)ob (y[f][ s])
;r( !c(b ))e
(y= 0; y<a
v/a 1[v
];y ++)
ob(01*y[v][s]);e
(y=0/1*1/1<<1<<1
<<1
;y<
a q
/a 1[q]
;y++)ob
(y[
q][
s])
;}i 0>>1<<0>>1<<
1*1/(1<<1<<01);}
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Richard Heathfield said:
Is it that time already? Here we go, then:
<snip>
Not sure what happened to the formatting there. The original, with proper
formatting, can be found here: http://www.cpax.org.uk/prg/portable/...s/obfusc/pal.c
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lorin Leone |
last post by:
Can anyone help me modify the program so that it recognizes strings
like "Anna" as palindromes. To make the program "case-insensitive."
using the built-in C++ function "toupper". and so that it recognizes
strings like
"race car" as palindromes, have the program ignore spaces in the input
string.
Here is my code:
|
by: Amar Prakash Tripaithi |
last post by:
Dan Hoey, who had recently graduated, wrote a C program to look for and
construct the following beauty:
A man, a plan, a caret, a ban, a myriad, a sum, a lac, a liar, a hoop,
a pint, a catalpa, a gas, an oil, a bird, a yell, a vat, a caw, a pax,
a wag, a tax, a nay, a ram, a cap, a yam, a gay, a tsar, a wall, a car,
a luger, a ward, a bin,...
|
by: outofmymind |
last post by:
hi,
im trying to solve the following question:
Create a class responsible for determining whether a string is a palindrome. Show your test cases. Palindome mypal("bob");
mypal.Ispalindrome(); // should return true
i tried to do the code, but im having problems in comlpeting it, I hope that some one can help me know...
|
by: colinNeedsJavaHelp |
last post by:
I am still having an exceptional amount of trouble with java. This is my new assignment, if anyone can help I would greatly appreciate it. I don't even know where to start.
A word or phrase in which the letters spell the same message when written forward and backward (with whitespaces and punctuations not considered) is called a palindrome.
...
|
by: Synapse |
last post by:
aloha people! I need help in my java palindrome program. It's a 5-digit palindrome checker. The code below is running good but i got a few problems on it.
If I enter 33633, 11211, 45554, it will return
It's a Palindrome!
and if I enter 33636 or 11214, it returns
It's not a Palindrome!
| |
by: Wabz |
last post by:
Hello mates,
Does anyone know how to write a function that tests if an integer is a
palindrome in C language?
|
by: vicestner |
last post by:
Write a Java program that prints the longest palindrome in an input file to standard output. A palindrome is a string whose reverse is the same as the original. Ignore case, whitespace, and punctuation in the input. If there are more than one palindrome of the maximum length, print the first one. Remove all space and punctuation and convert upper...
|
by: rubyhuang |
last post by:
i'm a new perl learner, this is the first perl task i will do. please help me.
The user can input a string, and then a script will check to see if the string is a palindrome or not, displaying the result to the user on another page (include the original string that they input in the displayed output). Disregard the case of letters, as well as...
|
by: bigtd08 |
last post by:
help writing this palindrome program for my c++ class.
HERE WHAT THE CODE SHOULD BE LIKE.
Write a program that takes a line of input from the keyboard and check to see if that line is a palindrome. Your program should ignore blanks, punctuation, and lettercase
Your program should output what the user entered as well as the reversed line.
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |