View Code of Problem 84

#include <stdio.h>
#include <string.h>


int main(void)
{
    char str[1000];
    while(gets(str) != NULL)
    {
        int i,j = 0,k,index = 1;
        char ch,str1[100];
        for(i = 0;i < strlen(str);i++)
        {
            if(str[i] != ' '  && i != strlen(str) - 1)
            {
                ch = str[i];
                str1[j++] = (ch >= 'A' && ch <= 'Z') ? ch + 32 : ch;
            }
            else if(str[i] == ' ')
            {
                str1[j] = '\0';
                if(strcmp(str1,"salt") == 0)
                    index = 0;
                j = 0;
            }
            else
            {
                ch = str[i];
                str1[j++] = (ch >= 'A' && ch <= 'Z') ? ch + 32 : ch;
                str1[j] = '\0';
                if(strcmp(str1,"salt") == 0)
                    index = 0;
                break;
            }
        }
        if(index == 0)
            puts(str);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 84