Basketball One-on-One : Kattis Solution in C++
#include<bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]){ string n; cin >> n; int len = n.length(); int scoreA = 0,scoreB = 0; for (int i = 0; i < len; i+=2) { if(n[i] == 'A'){ int score = n[i+1] - '0'; scoreA += score; }else if(n[i] == 'B'){ int score = n[i+1] - '0'; scoreB += score; } } (scoreA > scoreB) ? cout << 'A' : cout << 'B'; return 0; } question Link : https://open.kattis.com/problems/basketballoneonone