C # program to find counts of right greater characters for every character .
using System ; public class GFG { static void printGreaterCount ( String str ) { int len = str . Length ; int [ ] right = new int [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { for ( int j = i + 1 ; j < len ; j ++ ) { if ( str [ i ] < str [ j ] ) { right [ i ] ++ ; } } } for ( int i = 0 ; i < len ; i ++ ) { Console . Write ( right [ i ] + " ▁ " ) ; } }