K3AU02-Editorial

PROBLEM LINK:

Practice
Contest

Author: Dev Bhaskar Singh
Tester: Divyank Goyal
Editorialist: Anugya Jain

DIFFICULTY:

SIMPLE.

PREREQUISITES:

Basic knowledge of programming and its syntax.

PROBLEM:

Given a string s of size n. Remove all the characters in the string which are uppercase English alphabets, and print the resultant string.

EXPLANATION:

s[i] (0<=i <n) should not be equal to any character from A to Z .
Look at the code for better understanding.

SOLUTIONS:

Editorialist's Solution
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string s;
    cin>>n>>s;
    string ans="";
    for(int i=0;i<n;i++)
    {
        if(s[i]>='A' && s[i]<='Z')
        continue;
        ans+=s[i];
    }
    cout<<ans;
}