Codemind C Strings

BATHULA PRAVEEN (BP)
0

 Flip And Win

#include<stdio.h>

#include<stdlib.h>

int main()

{

    int n;

    scanf("%d",&n);

    char s[1000];

    scanf("%s",s);

    int i=0,sum=0;

    while(i<n-1)

    {

        sum+=abs(int(s[i+1]-int(s[i])));

        i++;

    }

    sum=n-sum-1;

    if(sum%3==0)

    {

        printf("Sudhir");

    }

    else

    {

        printf("Ashok");

    }

}



#include<stdio.h>
int main()
{
    char s[100];
    int c=0,c1=0;
    scanf("%[^
]s",s);
    for(int i=0;s[i]!=NULL;i++)
    {
        if (s[i]=='a' || s[i]=='e' || s[i]=='i'|| s[i]=='o' || s[i] =='u')
        {
            c++;
        }
        else
        {
            if(c1<c)
            {
                c1=c;
            }
            c=0;
        }
    }
    if(c1<c)
    {
        c1=c;
    }
    printf("%d",c1);
}

Zoos

#include<stdio.h>
int main()
{
    char s[200];
    scanf("%s",s);
    int n=0,c=0,i;
    for(i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='o')
        {
            n++;
        }
        else if(s[i]=='z')
        {
            c++;
        }
    }
    if(n==2*c)
    {
        printf("Yes");
    }
    else
    
       printf("No");
}


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

int main()
{
    int n,flag=0;
    scanf("%d",&n);
    char c[n];
    scanf("%s",c);
    for(int i=0;i<strlen(c);i++)
    {
        if(c[i]=='H'&&c[i+1]=='H')
        {
            flag=1;
        }
        else
        {
            if(c[i]=='.')
            c[i]='B';
        }
    }
    if(flag==1)
    {
    printf("NO
");
    }
    else
{
    printf("YES
");
    printf("%s",c);
}
}


#include<stdio.h>
#include<string.h>
        
int main()
{
    int i,n;
    char str[20];
    scanf("%[^
]s",str);
    n=strlen(str);
  
    for(i=n-1;i>=0;i--)
    {
       printf("%c",str[i]);
    }
    
}


#include<stdio.h>
int main()
{
    char s[1000];
    scanf("%[^
]s",s);
    printf("Hello Technicalhub
");
    printf("%s",s);
}


#include<stdio.h>
#include<string.h>
int main()
{
    char s[1000];
    scanf("%s",s);
    int i=0,d=strlen(s);
    for(int j=0;j<strlen(s);j++)
    {
        if(s[j]=='I')
        {
            printf("%d " ,i);
            i++;
        }
        else
        {
            printf("%d ",d);
            d--;
        }
    }
    printf("%d ",i);
}


#include<stdio.h>
#include<string.h>
        
int main()
{
    int i,n;
    char str[20];
    scanf("%[^
]s",str);
    n=strlen(str);
  
    for(i=n-1;i>=0;i--)
    {
       printf("%c",str[i]);
    }
    
}


#include<stdio.h>
int main()
{
    char s[100];
    int c=0,c1=0;
    scanf("%[^
]s",s);
    for(int i=0;s[i]!=NULL;i++)
    {
        if(s[i]==s[i+1])
        {
            c++;
        }
        else
        {
            if(c1<c)
            {
                c1=c;
            }
            c=0;
        }
    }
    if (c1<c)
    {
        c1=c;
    }
    printf("%d",c1+1);
}


#include <stdio.h>
#include <string.h>
 
int main()
{
    int i, j = 0, k = 0, x, len;
    char str[100], str1[10][20], temp;
 

    scanf("%[^
]s", str);

    for (i = 0;str[i] != NULL; i++)
    {
        if (str[i] == ' ')
        {
            str1[k][j]=NULL;
            k++;
            j=0;
        }
        else
        {
            str1[k][j]=str[i];
            j++;
        }
    }
    str1[k][j] = NULL;
 

    for (i = 0;i <= k;i++)
    {
        len = strlen(str1[i]);
        for (j = 0, x = len - 1;j < x;j++,x--)
        {
            temp = str1[i][j];
            str1[i][j] = str1[i][x];
            str1[i][x] = temp;
        }
    }
    for (i = 0;i <= k;i++)
    {
        printf("%s ", str1[i]);
    }
}


#include <stdio.h>
#include <string.h>
int main()
{
  char str[30];
 
  scanf("%[^
]", str);
  int i = 0;

  while (str[i] != NULL)
  {
    if (str[i] > 64 && str[i] < 91) 
      str[i] += 32;
    i++;
  }
  printf("%s",str);
}


#include<stdio.h>
int main()
{
    char s[100];
    int c=0,x=0;
    scanf("%[^
]s",s);
    for(int i=0;s[i]!=NULL;i++)
    {
        if(s[i]=='R')
        {
            c++;
        }
        if(s[i]=='L')
        {
            c--;
        }
        if(c==0)
        {
            x++;
        }
    }
    printf("%d",x);
}


#include <stdio.h>
#include <string.h>
 
int  main()
{
    char s[200];
    int count = 1, i;
    scanf("%[^
]s", s);
    for (i = 0;s[i] != NULL;i++)
    {
        if (s[i] == ' ')
        {
            count++;    
        }
}
    printf("%d",count);
}


Post a Comment

0Comments

Post a Comment (0)