#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char name[50]="abaaccsbvv";
int count[200]={0};
int i=0;
int flag=0;
for(i=0;i<strlen(name);i++)
{
count[name[i]]=count[name[i]]+1;
}
//printf("%d",strlen(name));
for(i=0;i<strlen(name);i++)
{
if(count[name[i]]==1)
{
printf("first non repeated alphabet is %c ",name[i]);
flag=1;
break;
}
//printf("%d",count[name[i]]);
}
if(flag==0)
{
printf("all alphabets are repeating");
}
getch();
}
output
first non repeated alphabet is s
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char name[50]="abaaccsbvv";
int count[200]={0};
int i=0;
int flag=0;
for(i=0;i<strlen(name);i++)
{
count[name[i]]=count[name[i]]+1;
}
//printf("%d",strlen(name));
for(i=0;i<strlen(name);i++)
{
if(count[name[i]]==1)
{
printf("first non repeated alphabet is %c ",name[i]);
flag=1;
break;
}
//printf("%d",count[name[i]]);
}
if(flag==0)
{
printf("all alphabets are repeating");
}
getch();
}
output
first non repeated alphabet is s
No comments:
Post a Comment