#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
int i,max=0,count=0,j;
char str[100]; /* ={"India IS DEMOCRATIC COUNTRY"}; u can use a string inside,in place of user input */
printf("\nEnter the string\n:");
gets(str);
for(i=0;i<strlen(str);i++)
{
if(!(str[i]==32))
{
count++;
}
else
{
if(max<count)
{
j=i-count;
max=count;
}
count=0;
}
}
for(i=j;i<(j+max);i++)
printf("%c",str[i]);
getch();
}
what is if(!(str[i]==32))
what is if(!(str[i]==32))
helicopter
Check the documentation of the String class, for a method that searches for a substring.
You can do this: <?php if ( $word === strrev( $word ) ) { echo "The word is a palindrome"; } else { echo "The word is not a palindrome"; }
class LongestWord{String str = "Ram is intelligent boy";String stringArray[] = str.split("\\s");public String compare(String st1, String st2){if(st1.length()>st2.length()){return st1;}else{return st2;}}LongestWord(){String word = "";for(int i=0;i
No, the word 'largest' is an adjective; the superlative form for the adjective large:largelargerlargestExample: We bought the largest melon we could find.
String him along is a saying. It begins with the word string.
#include<stdio.h> void main() { int cnt=0,i; char str[100]; printf("Enter the string "); scanf("%s",str); for(i=0;i<strlen(str)-1;i++) { if(str[i]==' ') cnt++; } printf("\nTotal no. of word in string = %d",cnt); }
import java.util.Scanner; public class Palindrome{ public static void main(String[] args){ String front; String back =""; char[] failure; String backwards; Scanner input=new Scanner(System.in); System.out.print("Enter a word: "); front=input.next(); front=front.replaceAll(" ", ""); failure=front.toCharArray(); for (int i=0; i<failure.length; i++){ back=failure[i] + back; } if (front.equals(back)){ System.out.print("That word is a palindrome"); }else System.out.print("That word is not a palindrome"); }}
Microsoft Word will find specific words.
You could use a function like this:function isPalindrome($string) {$string = strtolower($string);return (strrev($string) == $string) ? true : false;}and then to check a palindrome call an if statement like so:if(isPalindrome($test)) {echo $test.' is a palindrome';}else {echo $test.' is not a palindrome';}