A - CBC
Source: atcoder
Difficulty: 100

Problem Statement
You are given a string
S
consisting of uppercase and lowercase English letters. Print the string obtained by concatenating only the uppercase letters of
S
in their original order.
Constraints
S
is a string of uppercase and lowercase English letters.
The length of
S
is between
1
and
100
, inclusive.
Input
The input is given from Standard Input in the following format:
S
Output
Print the string obtained by concatenating only the uppercase letters of
S
in their original order.
Sample Input 1
AtCoderBeginnerContest
Sample Output 1
ACBC
The string obtained by concatenating only the uppercase letters of
S
in their original order is
ACBC
. Hence, print
ACBC
.
Sample Input 2
PaymentRequired
Sample Output 2
PR
Sample Input 3
program
Sample Output 3
Note that
S
may contain no uppercase letters.

C++ solution:
#include <bits/stdc++.h>
using namespace std;

#define loop(i, a, b) for (int i = (a); i < (b); i++)
#define sz(x) ((int)x.size())
#define trav(a, x) for (auto& a : x)
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair

typedef long long ll;

const ll MOD = 1e9 + 7;
const ll INF = 1e18;

ll safeMult(ll a, ll b) {
    if (a == 0 || b == 0) return 0;
    if (a > INF / b) return INF;
    return a * b;
}

ll Pow(ll base, ll exp) {
    ll result = 1;
    while (exp > 0) {
        if (exp % 2 == 1) {
            result = safeMult(result, base);
            if (result == INF) return INF;
        }
        base = safeMult(base, base);
        if (base == INF) return INF;
        exp /= 2;
    }
    return result;
}

bool isPerfectSquare(ll n) {
    ll root = sqrt(n);
    return root * root == n;
}

bool isPowerOfTwo(ll n) {
    return n > 0 && (n & (n - 1)) == 0;
}

ll setBitsUpToHighestBit(ll x) {
    x |= x >> 1;
    x |= x >> 2;
    x |= x >> 4;
    x |= x >> 8;
    x |= x >> 16;
    return x;
}

bool isPrime(ll n) {
    if (n < 2) return false;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

vector<ll> generatePrimes(ll n) {
    vector<bool> isPrime(n + 1, true);
    vector<ll> primes;
    isPrime[0] = isPrime[1] = false;

    for (int p = 2; p <= n; ++p) {
        if (isPrime[p]) {
            primes.push_back(p);
            for (int multiple = 2 * p; multiple <= n; multiple += p) {
                isPrime[multiple] = false;
            }
        }
    }
    return primes;
}

ll xorRange(ll l, ll r) {
    // XOR from 0 to a given number x
    auto xorUpto = [](ll x) -> ll {
        ll rem = x % 4;
        if (rem == 0) {
            return x;
        }
        else if (rem == 1) {
            return 1;
        }
        else if (rem == 2) {
            return x + 1;
        }
        else {
            return 0;
        }
    };
    return xorUpto(r) ^ xorUpto(l - 1);
}



void solve() {
    
    string s;
    cin >> s;
    
    ll n = s.size();
    for (ll i = 0; i < n; i++) {
        if (s[i] >= 'A' && s[i] <= 'Z') {
            cout << s[i];
        }
    }
    
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    //cin >> t;

    while (t--) {
        solve();
    }
    return 0;
}

Go solution:
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

var iost *Iost

type Iost struct {
	Scanner *bufio.Scanner
	Writer  *bufio.Writer
}

func NewIost(fp io.Reader, wfp io.Writer) *Iost {
	const BufSize = 2000005
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, BufSize), BufSize)
	return &Iost{Scanner: scanner, Writer: bufio.NewWriter(wfp)}
}
func (i *Iost) Text() string {
	if !i.Scanner.Scan() {
		panic("scan failed")
	}
	return i.Scanner.Text()
}
func (i *Iost) Atoi(s string) int                 { x, _ := strconv.Atoi(s); return x }
func (i *Iost) GetNextInt() int                   { return i.Atoi(i.Text()) }
func (i *Iost) Atoi64(s string) int64             { x, _ := strconv.ParseInt(s, 10, 64); return x }
func (i *Iost) GetNextInt64() int64               { return i.Atoi64(i.Text()) }
func (i *Iost) Atof64(s string) float64           { x, _ := strconv.ParseFloat(s, 64); return x }
func (i *Iost) GetNextFloat64() float64           { return i.Atof64(i.Text()) }
func (i *Iost) Print(x ...interface{})            { fmt.Fprint(i.Writer, x...) }
func (i *Iost) Printf(s string, x ...interface{}) { fmt.Fprintf(i.Writer, s, x...) }
func (i *Iost) Println(x ...interface{})          { fmt.Fprintln(i.Writer, x...) }
func isLocal() bool                               { return os.Getenv("NICKEL") == "BACK" }
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	if isLocal() {
		fp, _ = os.Open(os.Getenv("WELL_EVERYBODY_LIES_TOO_MUCH"))
	}
	iost = NewIost(fp, wfp)
	defer func() {
		iost.Writer.Flush()
	}()
	solve()
}
func solve() {
	s := iost.Text()
	t := strings.ToUpper(s)
	for i := 0; i < len(s); i++ {
		if s[i] == t[i] {
			iost.Printf("%c", s[i])
		}
	}
	iost.Println("")
}

Java solution:
import java.io.*;
import java.util.*;

class Main {
	String S;
	
	void main() {
		S = next();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < S.length(); i++) {
			char c = S.charAt(i);
			if (c < 'a') sb.append(c);
		}
		System.out.println(sb);
	}

	// ---
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String next() { try { return br.readLine(); } catch (Exception e) { return null; } }

	public static void main(String[] args) {
		new Main().main();
	}
}

JavaScript solution:
process.stdin.setEncoding('utf8');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
    input_stdin += data;
});

process.stdin.on('end', function () {
    input_stdin_array = input_stdin.split("\n");
    main();
});

function readLine() {
    return input_stdin_array[input_currentline++];
}

function solution(n){
  let result=""
  for(let i=0;i<n.length;i++){
    if(n[i].charCodeAt(0)>=65&&n[i].charCodeAt(0)<=90) result+=n[i]
  }
  return result

}
    
function main() {
    // let t = parseInt(readLine());
    let t = 1;
    while(t--){
        let n = readLine();
        let res = solution(n);
        console.log(res);
    }
}

Python solution:
s = input()
for i in s:
    if i.isupper():
        print(i, end = "")

Ruby solution:
s = gets.chomp
a = ""

s.each_char do |b|
  a += b if b.match?(%r/[A-Z]/)
end

puts a