codeforces 520A problem solution in c/c++
// 520A.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
//# include "pch.h"
# include <iostream>
# include<string>
using namespace std;
int main()
{
string anis;
string anis1;
int nn,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,ii=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;
cin >> nn;
cin >> anis;
for (int i = 0;i < nn;i++)
{
if (anis[i] == 'A' || anis[i] == 'a')
{
a++;
}
else if (anis[i] == 'B' || anis[i] == 'b')
{
b++;
}
else if (anis[i] == 'C' || anis[i] == 'c')
{
c++;
}
if (anis[i] == 'D' || anis[i] == 'd')
{
d++;
}
else if (anis[i] == 'e' || anis[i] == 'E')
{
e++;
}
else if (anis[i] == 'F' || anis[i] == 'f')
{
f++;
}
if (anis[i] == 'G' || anis[i] == 'g')
{
g++;
}
else if (anis[i] == 'H' || anis[i] == 'h')
{
h++;
}
else if (anis[i] == 'I' || anis[i] == 'i')
{
ii++;
}
if (anis[i] == 'j' || anis[i] == 'J')
{
j++;
}
else if (anis[i] == 'K' || anis[i] == 'k')
{
k++;
}
else if (anis[i] == 'l' || anis[i] == 'L')
{
l++;
}
if (anis[i] == 'M' || anis[i] == 'm')
{
m++;
}
else if (anis[i] == 'N' || anis[i] == 'n')
{
n++;
}
else if (anis[i] == 'O' || anis[i] == 'o')
{
o++;
}
if (anis[i] == 'P' || anis[i] == 'p')
{
p++;
}
else if (anis[i] == 'q' || anis[i] == 'Q')
{
q++;
}
else if (anis[i] == 'R' || anis[i] == 'r')
{
r++;
}
if (anis[i] == 'S' || anis[i] == 's')
{
s++;
}
else if (anis[i] == 'T' || anis[i] == 't')
{
t++;
}
else if (anis[i] == 'U' || anis[i] == 'u')
{
u++;
}
if (anis[i] == 'V' || anis[i] == 'v')
{
v++;
}
else if (anis[i] == 'W' || anis[i] == 'w')
{
w++;
}
else if (anis[i] == 'X' || anis[i] == 'x')
{
x++;
}
if (anis[i] == 'y' || anis[i] == 'Y')
{
y++;
}
else if (anis[i] == 'Z' || anis[i] == 'z')
{
z++;
}
}
if (a == 0 || b == 0 || c == 0 || d == 0 || e == 0 || f == 0 || g == 0 || h == 0 || ii == 0 || j == 0 || k == 0 || l == 0 || m == 0 || n == 0 || o == 0 || p == 0 || q == 0 || r == 0 || s == 0 || t == 0 || u == 0 || v == 0 || w == 0 || x == 0 || y == 0 || z == 0)
{
cout << "NO";
}
else
{
cout << "YES";
}
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
//
//# include "pch.h"
# include <iostream>
# include<string>
using namespace std;
int main()
{
string anis;
string anis1;
int nn,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,ii=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0;
cin >> nn;
cin >> anis;
for (int i = 0;i < nn;i++)
{
if (anis[i] == 'A' || anis[i] == 'a')
{
a++;
}
else if (anis[i] == 'B' || anis[i] == 'b')
{
b++;
}
else if (anis[i] == 'C' || anis[i] == 'c')
{
c++;
}
if (anis[i] == 'D' || anis[i] == 'd')
{
d++;
}
else if (anis[i] == 'e' || anis[i] == 'E')
{
e++;
}
else if (anis[i] == 'F' || anis[i] == 'f')
{
f++;
}
if (anis[i] == 'G' || anis[i] == 'g')
{
g++;
}
else if (anis[i] == 'H' || anis[i] == 'h')
{
h++;
}
else if (anis[i] == 'I' || anis[i] == 'i')
{
ii++;
}
if (anis[i] == 'j' || anis[i] == 'J')
{
j++;
}
else if (anis[i] == 'K' || anis[i] == 'k')
{
k++;
}
else if (anis[i] == 'l' || anis[i] == 'L')
{
l++;
}
if (anis[i] == 'M' || anis[i] == 'm')
{
m++;
}
else if (anis[i] == 'N' || anis[i] == 'n')
{
n++;
}
else if (anis[i] == 'O' || anis[i] == 'o')
{
o++;
}
if (anis[i] == 'P' || anis[i] == 'p')
{
p++;
}
else if (anis[i] == 'q' || anis[i] == 'Q')
{
q++;
}
else if (anis[i] == 'R' || anis[i] == 'r')
{
r++;
}
if (anis[i] == 'S' || anis[i] == 's')
{
s++;
}
else if (anis[i] == 'T' || anis[i] == 't')
{
t++;
}
else if (anis[i] == 'U' || anis[i] == 'u')
{
u++;
}
if (anis[i] == 'V' || anis[i] == 'v')
{
v++;
}
else if (anis[i] == 'W' || anis[i] == 'w')
{
w++;
}
else if (anis[i] == 'X' || anis[i] == 'x')
{
x++;
}
if (anis[i] == 'y' || anis[i] == 'Y')
{
y++;
}
else if (anis[i] == 'Z' || anis[i] == 'z')
{
z++;
}
}
if (a == 0 || b == 0 || c == 0 || d == 0 || e == 0 || f == 0 || g == 0 || h == 0 || ii == 0 || j == 0 || k == 0 || l == 0 || m == 0 || n == 0 || o == 0 || p == 0 || q == 0 || r == 0 || s == 0 || t == 0 || u == 0 || v == 0 || w == 0 || x == 0 || y == 0 || z == 0)
{
cout << "NO";
}
else
{
cout << "YES";
}
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Comments
Post a Comment