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");
}
}
Program_to_find_the_longest_substring_length_that_contains_(a,_e,_i,_o,_u)_only
#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");
}
Split_houses
#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);
}
}
Reverse_String
#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]);
}
}
Hello_Technicalhub
#include<stdio.h>
int main()
{
char s[1000];
scanf("%[^
]s",s);
printf("Hello Technicalhub
");
printf("%s",s);
}
DI_String_Match
#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);
}
Reverse_String
#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]);
}
}
Consecutive_Characters
#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);
}
Reverse_Words_in_a_String_III
#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]);
}
}
To_Lower_Case.
#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);
}
Split_a_String_in_Balanced_Strings
#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);
}
Count_no._of_words
#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);
}