online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define int ll void solve() { // cout << "Case #" << ++Google_Test << ": "; string s; cin >> s; vector<int> cnt(26); int tot = 0; int flag = 0; for(char c:s) { cnt[c-'a']++; tot++; if(cnt[c-'a']>1) flag = 1; } int ans = 0; for(int i:cnt) ans += (tot-i)*i; cout << ans/2 + flag << endl; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //Test solve(); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue