dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static String reverse ( char [ ] str , int len , int l , int r ) { if ( l < 0 r >= len l > r ) return " Invalid ▁ range ! " ; while ( l < r ) { char c = str [ l ] ; str [ l ] = str [ r ] ; str [ r ] = c ; l ++ ; r -- ; } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int len = str . Length ; int l = 5 , r = 7 ; Console . WriteLine ( reverse ( str . ToCharArray ( ) , len , l , r ) ) ; } }

Index/key variables: l, r
Accumulator variables: l, r
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void encrypt ( char [ ] input ) { char evenPos = ' @ ' , oddPos = ' ! ' ; int repeat , ascii ; for ( int i = 0 ; i < input . Length ; i ++ ) { ascii = input [ i ] ; repeat = ascii >= 97 ? ascii - 96 : ascii - 64 ; for ( int j = 0 ; j < repeat ; j ++ ) { if ( i % 2 == 0 ) Console . Write ( " { 0 } " , oddPos ) ; else Console . Write ( " { 0 } " , evenPos ) ; } } } public static void Main ( String [ ] args ) { char [ ] input = { ' A ' , ' b ' , ' C ' , ' d ' } ; encrypt ( input ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool IsRedundantBraces ( string A ) { int a = 0 , b = 0 ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] == ' ( ' && A [ i + 2 ] == ' ) ' ) return true ; if ( A [ i ] == ' * ' A [ i ] == ' + ' A [ i ] == ' - ' A [ i ] == ' / ' ) a ++ ; if ( A [ i ] == ' ( ' ) b ++ ; } if ( b > a ) return true ; return false ; } public static void Main ( String [ ] args ) { String A = " ( ( ( a + b ) ▁ + ▁ c ) ▁ + ▁ d ) " ; if ( IsRedundantBraces ( A ) ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } }

Index/key variables: i
Accumulator variables: a, b, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string balancedBrackets ( string str ) { int dep = 0 ; int minDep = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ' ( ' ) dep ++ ; else dep -- ; if ( minDep > dep ) minDep = dep ; } if ( minDep < 0 ) { for ( int i = 0 ; i < Math . Abs ( minDep ) ; i ++ ) str = ' ( ' + str ; } dep = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ' ( ' ) dep ++ ; else dep -- ; } if ( dep != 0 ) { for ( int i = 0 ; i < dep ; i ++ ) str = str + ' ) ' ; } return str ; } public static void Main ( ) { String str = " ) ) ) ( ) " ; Console . WriteLine ( balancedBrackets ( str ) ) ; } }

Index/key variables: i
Accumulator variables: dep, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( string str , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( str [ ( i ) ] != str [ ( i + 1 ) ] ) count ++ ; } return ( count + 1 ) / 2 ; } public static void Main ( ) { string str = "000111" ; int n = str . Length ; Console . WriteLine ( minOperations ( str , n ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int find_digit ( String s , int n ) { int first_digit = - 1 , i ; for ( i = n - 1 ; i >= 0 ; i -- ) { if ( s [ i ] < '0' s [ i ] > '9' ) { first_digit = i ; break ; } } first_digit ++ ; int s_len = first_digit ; int num = 0 , pw = 1 ; i = n - 1 ; while ( i >= 0 ) { if ( s [ i ] >= '0' && s [ i ] <= '9' ) { int digit = s [ i ] - '0' ; num = num + ( pw * digit ) ; if ( num >= s_len ) return - 1 ; pw = pw * 10 ; } i -- ; } num = num * 10 ; int req = s_len - num ; if ( req > 9 req < 0 ) return - 1 ; return req ; } public static void Main ( String [ ] args ) { String s = " abcd0" ; int n = s . Length ; Console . Write ( find_digit ( s , n ) ) ; } }

Index/key variables: i
Accumulator variables: first_digit, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool canConvert ( string str1 , string str2 ) { int i = 0 , j = 0 ; while ( i < str1 . Length && j < str2 . Length ) { if ( str1 [ i ] != str2 [ j ] ) { if ( str1 [ i ] == '0' && str2 [ j ] == '1' && i + 1 < str1 . Length && str1 [ i + 1 ] == '0' ) { i += 2 ; j ++ ; } else { return false ; } } else { i ++ ; j ++ ; } } if ( i == str1 . Length && j == str2 . Length ) return true ; return false ; } public static void Main ( ) { string str1 = "00100" , str2 = "111" ; if ( canConvert ( str1 , str2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static void reverse ( string s ) { Stack stc = new Stack ( ) ; string temp = " " ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == ' ▁ ' ) { stc . Push ( temp ) ; temp = " " ; } else { temp = temp + s [ i ] ; } } stc . Push ( temp ) ; while ( stc . Count != 0 ) { temp = ( string ) stc . Peek ( ) ; Console . Write ( temp + " ▁ " ) ; stc . Pop ( ) ; } Console . WriteLine ( ) ; } static void Main ( ) { string s = " I ▁ Love ▁ To ▁ Code " ; reverse ( s ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printMatrix ( int n , int m ) { if ( n < 5 m < 5 ) { Console . Write ( - 1 ) ; return ; } char [ ] s = " aeiou " . ToCharArray ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { Console . Write ( s [ j % 5 ] + " ▁ " ) ; } Console . WriteLine ( ) ; char c = s [ 0 ] ; for ( int k = 0 ; k < 4 ; k ++ ) { s [ k ] = s [ k + 1 ] ; } s [ 4 ] = c ; } } public static void Main ( String [ ] args ) { int n = 5 , m = 5 ; printMatrix ( n , m ) ; } }

Index/key variables: k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isTwoAlter ( string s ) { for ( int i = 0 ; i < s . Length - 2 ; i ++ ) { if ( s [ i ] != s [ i + 2 ] ) { return false ; } } if ( s [ 0 ] == s [ 1 ] ) return false ; return true ; } public static void Main ( ) { string str = " ABAB " ; if ( isTwoAlter ( str ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( int n , string a , string b , string c ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char x = a [ i ] ; char y = b [ i ] ; char z = c [ i ] ; if ( x == y && y == z ) { ; } else if ( x == y y == z x == z ) { ans ++ ; } else { ans += 2 ; } } return ans ; } public static void Main ( ) { string a = " place " ; string b = " abcde " ; string c = " plybe " ; int n = a . Length ; Console . Write ( minOperations ( n , a , b , c ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool check ( String s ) { int n = s . Length ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( s [ i ] > s [ i + 1 ] ) return true ; } return false ; } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; if ( check ( s ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubStr ( String str , int n , char x ) { int res = 0 , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == x ) { res += ( ( count + 1 ) * ( n - i ) ) ; count = 0 ; } else count ++ ; } return res ; } public static void Main ( String [ ] args ) { String str = " abcabc " ; int n = str . Length ; char x = ' c ' ; Console . WriteLine ( countSubStr ( str , n , x ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubStr ( string str , int n ) { int len = str . Length ; return ( len - n + 1 ) ; } public static void Main ( ) { string str = " geeksforgeeks " ; int n = 5 ; Console . WriteLine ( countSubStr ( str , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubstrings ( string s , char c ) { int n = s . Length ; int cnt = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] != c ) cnt ++ ; else { sum += ( cnt * ( cnt + 1 ) ) / 2 ; cnt = 0 ; } } sum += ( cnt * ( cnt + 1 ) ) / 2 ; return sum ; } public static void Main ( ) { string s = " baa " ; char c = ' b ' ; Console . Write ( countSubstrings ( s , c ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static int getMinimizedSum ( string str , int len ) { int i , maxVal = Int32 . MinValue , sum = 0 ; int [ ] occurrences = new int [ 26 ] ; for ( i = 0 ; i < len ; i ++ ) { occurrences [ str [ i ] - ' a ' ] ++ ; sum += ( int ) str [ i ] ; } for ( i = 0 ; i < 26 ; i ++ ) maxVal = Math . Max ( maxVal , occurrences [ i ] * ( i + ' a ' ) ) ; return ( sum - maxVal ) ; } public static void Main ( ) { string str = " geeksforgeeks " ; int len = str . Length ; Console . WriteLine ( getMinimizedSum ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static bool isPalindrome ( string s ) { int i = 0 ; int j = s . Length - 1 ; while ( i < j ) { if ( s [ i ] != s [ j ] ) return false ; i ++ ; j -- ; } return true ; } static int getIndex ( string S1 , string S2 , int n ) { string S = " " ; for ( int i = 0 ; i < n ; i ++ ) { S = S + S1 [ i ] ; string Temp = " " ; for ( int j = i + 1 ; j < n ; j ++ ) Temp += S2 [ j ] ; if ( isPalindrome ( S + Temp ) ) { return i ; } } return - 1 ; } public static void Main ( ) { string S1 = " abcdf " , S2 = " sfgba " ; int n = S1 . Length ; Console . WriteLine ( getIndex ( S1 , S2 , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: Temp, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPalindrome ( string s , int i , int j ) { while ( i < j ) { if ( s [ i ] != s [ j ] ) return false ; i ++ ; j -- ; } return true ; } static int getIndex ( string s1 , string s2 , int len ) { int i = 0 , j = len - 1 ; while ( i < j ) { if ( s1 [ i ] != s2 [ j ] ) { break ; } i ++ ; j -- ; } if ( i == j ) { return i - 1 ; } else if ( isPalindrome ( s2 , i , j ) ) return i - 1 ; else if ( isPalindrome ( s1 , i , j ) ) return j ; return - 1 ; } public static void Main ( ) { string s1 = " abcdf " , s2 = " sfgba " ; int len = s1 . Length ; Console . WriteLine ( getIndex ( s1 , s2 , len ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int count_acronym ( int n , string [ ] arr ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < n ; i ++ ) freq [ arr [ i ] [ 0 ] - ' a ' ] ++ ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { string st = arr [ i ] ; int [ ] num = new int [ 26 ] ; for ( int j = 0 ; j < st . Length ; j ++ ) num [ st [ j ] - ' a ' ] ++ ; bool flag = true ; for ( int j = 1 ; j < 26 ; j ++ ) { if ( num [ j ] > freq [ j ] ) { flag = false ; break ; } } int x = st [ 0 ] - ' a ' ; if ( freq [ x ] - 1 < num [ x ] ) flag = false ; if ( flag ) cnt ++ ; } return cnt ; } public static void Main ( ) { string [ ] arr = { " abc " , " bcad " , " cabd " , " cba " , " dzzz " } ; int n = arr . Length ; Console . WriteLine ( count_acronym ( n , arr ) ) ; } }

Index/key variables: i, j, x
Accumulator variables: cnt, i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static bool valid ( int [ ] cnt ) { for ( int i = 0 ; i < 26 ; i ++ ) { if ( cnt [ i ] >= 2 ) return false ; } return true ; } static string getGoodString ( string ss , int n ) { char [ ] s = ss . ToCharArray ( ) ; if ( n < 26 ) return " - 1" ; int [ ] cnt = new int [ 27 ] ; for ( int i = 25 ; i < n ; i ++ ) { for ( int j = i ; j >= i - 25 ; j -- ) { if ( s [ j ] != ' ? ' ) cnt [ ( ( int ) s [ j ] - ( int ) ' a ' ) ] ++ ; } if ( valid ( cnt ) ) { int cur = 0 ; while ( cnt [ cur ] > 0 ) cur ++ ; for ( int j = i - 25 ; j <= i ; j ++ ) { if ( s [ j ] == ' ? ' ) { s [ j ] = ( char ) ( cur + ( int ) ( ' a ' ) ) ; cur ++ ; while ( cnt [ cur ] > 0 ) cur ++ ; } } return new String ( s ) ; } } return " - 1" ; } static void Main ( ) { string s = " abcdefghijkl ? nopqrstuvwxy ? " ; int n = s . Length ; Console . WriteLine ( getGoodString ( s , n ) ) ; } }

Index/key variables: cur, i, j
Accumulator variables: cur, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isVowel ( char c ) { c = char . ToLower ( c ) ; if ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) { return true ; } return false ; } static String swapRepeated ( char [ ] str ) { for ( int i = 0 ; i < str . Length - 1 ; i ++ ) { char c = ( char ) 0 ; if ( ( isVowel ( str [ i ] ) && isVowel ( str [ i + 1 ] ) ) || ( ! isVowel ( str [ i ] ) && ! isVowel ( str [ i + 1 ] ) ) ) { c = str [ i ] ; str [ i ] = str [ i + 1 ] ; str [ i + 1 ] = c ; } } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; Console . WriteLine ( swapRepeated ( str . ToCharArray ( ) ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string largestPalinSub ( string s ) { string res = " " ; char mx = s [ 0 ] ; for ( int i = 1 ; i < s . Length ; i ++ ) mx = ( char ) Math . Max ( ( int ) mx , ( int ) s [ i ] ) ; for ( int i = 0 ; i < s . Length ; i ++ ) if ( s [ i ] == mx ) res += s [ i ] ; return res ; } public static void Main ( ) { string s = " geeksforgeeks " ; Console . WriteLine ( largestPalinSub ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printString ( char [ ] str , int n ) { int ones = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( str [ i ] == '1' ) ones ++ ; bool used = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '2' && ! used ) { used = true ; for ( int j = 0 ; j < ones ; j ++ ) Console . Write ( "1" ) ; } if ( str [ i ] != '1' ) Console . Write ( str [ i ] ) ; } if ( ! used ) for ( int j = 0 ; j < ones ; j ++ ) Console . Write ( "1" ) ; } public static void Main ( String [ ] args ) { String str = "100210" ; int n = str . Length ; printString ( str . ToCharArray ( ) , n ) ; } }

Index/key variables: i
Accumulator variables: i, j, ones
Iterator variables: i, j
Boolean variables: used
Class/struct names: GFG
C# program:
using System ; class solution { static int findPermutation ( string str , int k ) { bool [ ] has = new bool [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) has [ i ] = false ; int cnt = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( ! has [ str [ i ] - ' a ' ] ) { cnt ++ ; has [ str [ i ] - ' a ' ] = true ; } } int ans = 1 ; for ( int i = 2 ; i <= cnt ; i ++ ) ans *= i ; for ( int i = cnt - k ; i > 1 ; i -- ) ans /= i ; return ans ; } public static void Main ( ) { string str = " geeksforgeeks " ; int k = 4 ; Console . WriteLine ( findPermutation ( str , k ) ) ; } }

Index/key variables: i
Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: solution
C# program:
using System ; class GFG { static int product ( int x ) { int prod = 1 ; while ( x > 0 ) { prod *= ( x % 10 ) ; x /= 10 ; } return prod ; } static int findNumber ( int l , int r ) { string b = r . ToString ( ) ; int ans = r ; for ( int i = 0 ; i < b . Length ; i ++ ) { if ( b [ i ] == '0' ) continue ; char [ ] curr = b . ToCharArray ( ) ; curr [ i ] = ( char ) ( ( ( int ) ( curr [ i ] - ( int ) '0' ) - 1 ) + ( int ) ( '0' ) ) ; for ( int j = i + 1 ; j < curr . Length ; j ++ ) curr [ j ] = '9' ; int num = 0 ; for ( int j = 0 ; j < curr . Length ; j ++ ) num = num * 10 + ( curr [ j ] - '0' ) ; if ( num >= l && product ( ans ) < product ( num ) ) ans = num ; } return ans ; } static void Main ( ) { int l = 1 , r = 10 ; Console . WriteLine ( findNumber ( l , r ) ) ; l = 51 ; r = 62 ; Console . WriteLine ( findNumber ( l , r ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, prod, x
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void printExpansion ( String str ) { for ( int i = ( int ) str . Length - 1 ; i >= 0 ; i -- ) { String subStr = str . Substring ( i ) ; Console . Write ( subStr ) ; } } static public void Main ( String [ ] args ) { String str = " geeks " ; printExpansion ( str ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void constructBinString ( int a , int b , int x ) { int d , i ; d = x / 2 ; if ( x % 2 == 0 && x / 2 != a ) { d -- ; Console . Write ( "0" ) ; a -- ; } for ( i = 0 ; i < d ; i ++ ) Console . Write ( "10" ) ; a = a - d ; b = b - d ; for ( i = 0 ; i < b ; i ++ ) { Console . Write ( "1" ) ; } for ( i = 0 ; i < a ; i ++ ) { Console . Write ( "0" ) ; } } public static void Main ( ) { int a = 4 , b = 3 , x = 2 ; constructBinString ( a , b , x ) ; } }

Accumulator variables: a, d, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool matchPattern ( string s ) { int count = 0 ; int n = s . Length ; int i = 0 ; while ( i < n ) { while ( i < n && s [ i ] == ' a ' ) { count ++ ; i ++ ; } while ( i < n && s [ i ] == ' b ' ) { count -- ; i ++ ; } if ( count != 0 ) return false ; } return true ; } public static void Main ( ) { string s = " bb " ; if ( matchPattern ( s ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: count, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximum_one ( string s , int n ) { int cnt_one = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) cnt_one ++ ; } int [ ] left = new int [ n ] ; int [ ] right = new int [ n ] ; if ( s [ 0 ] == '1' ) left [ 0 ] = 1 ; else left [ 0 ] = 0 ; if ( s [ n - 1 ] == '1' ) right [ n - 1 ] = 1 ; else right [ n - 1 ] = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) left [ i ] = left [ i - 1 ] + 1 ; else left [ i ] = 0 ; } for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( s [ i ] == '1' ) right [ i ] = right [ i + 1 ] + 1 ; else right [ i ] = 0 ; } int cnt = 0 , max_cnt = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( s [ i ] == '0' ) { int sum = left [ i - 1 ] + right [ i + 1 ] ; if ( sum < cnt_one ) cnt = sum + 1 ; else cnt = sum ; max_cnt = Math . Max ( max_cnt , cnt ) ; cnt = 0 ; } } return max_cnt ; } public static void Main ( ) { string s = "111011101" ; Console . WriteLine ( maximum_one ( s , s . Length ) ) ; } }

Index/key variables: i, n
Accumulator variables: cnt_one, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string MaxFreq ( string str ) { int n = str . Length ; Dictionary < string , int > m = new Dictionary < string , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { string sp = " " ; for ( int j = i ; j < n ; j ++ ) { sp += str [ j ] ; if ( m . ContainsKey ( sp ) ) { m [ sp ] ++ ; } else { m [ sp ] = 1 ; } } } int maxi = 0 ; string s = " " ; foreach ( KeyValuePair < string , int > i in m ) { if ( i . Value > maxi ) { maxi = i . Value ; s = i . Key ; } else if ( i . Value == maxi ) { string ss = i . Key ; if ( ss . Length > s . Length ) s = ss ; } } return s ; } public static void Main ( string [ ] args ) { string str = " ababecdecd " ; Console . Write ( MaxFreq ( str ) ) ; } }

Index/key variables: j, sp
Accumulator variables: i, j, sp
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxFreq ( string s , int a , int b ) { int [ ] fre = new int [ 10 ] ; int n = s . Length ; if ( a > b ) { int temp = a ; a = b ; b = temp ; } for ( int i = 0 ; i < n ; i ++ ) fre [ s [ i ] - '0' ] ++ ; if ( fre [ a ] == 0 && fre [ b ] == 0 ) return - 1 ; else if ( fre [ a ] >= fre [ b ] ) return a ; else return b ; } public static void Main ( ) { int a = 4 , b = 7 ; string s = "47744" ; Console . WriteLine ( maxFreq ( s , a , b ) ) ; } }

Index/key variables: a, b, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void convert ( int n , String a , String b ) { int [ ] l = new int [ n ] ; int i ; for ( i = 0 ; i < n ; i ++ ) l [ i ] = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] ) l [ i ] = 1 ; } int cc = 0 ; int vl = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( l [ i ] == 0 ) { if ( vl != 0 ) cc += 1 ; vl = 0 ; } else vl += 1 ; } if ( vl != 0 ) cc += 1 ; Console . WriteLine ( cc ) ; } static public void Main ( ) { String a = "101010" ; String b = "110011" ; int n = a . Length ; convert ( n , a , b ) ; } }

Index/key variables: i, n
Accumulator variables: cc, i, vl
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void StringMatch ( String s ) { int lo = 0 , hi = s . Length , len = s . Length ; List < int > ans = new List < int > ( ) ; for ( int x = 0 ; x < len ; x ++ ) { if ( s [ x ] == ' I ' ) { ans . Add ( lo ) ; lo += 1 ; } else { ans . Add ( hi ) ; hi -= 1 ; } } ans . Add ( lo ) ; Console . Write ( " [ " ) ; for ( int i = 0 ; i < ans . Count ; i ++ ) { Console . Write ( ans [ i ] ) ; if ( i != ans . Count - 1 ) Console . Write ( " , " ) ; } Console . Write ( " ] " ) ; } public static void Main ( String [ ] args ) { String S = " IDID " ; StringMatch ( S ) ; } }

Index/key variables: i, x
Accumulator variables: hi, i, lo, x
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int countWays ( string s1 , string s2 , int n ) { int a , b , c , d ; a = b = c = d = 0 ; int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s2 [ i ] == '0' ) { if ( s1 [ i ] == '0' ) { c ++ ; } else { d ++ ; } } else { if ( s1 [ i ] == '0' ) { a ++ ; } else { b ++ ; } } } result = a * d + b * c + c * d ; return result ; } public static void Main ( ) { int n = 5 ; string s1 = "01011" ; string s2 = "11001" ; Console . WriteLine ( countWays ( s1 , s2 , n ) ) ; } }

Index/key variables: i
Accumulator variables: a, b, c, d, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static int returnWinner ( String s , int l ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < l ; i ++ ) { freq [ s [ i ] - ' a ' ] ++ ; } int cnt = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] % 2 != 0 ) cnt ++ ; } if ( ( cnt == 0 ) || ( cnt & 1 ) == 1 ) return 1 ; else return 2 ; } public static void Main ( String [ ] args ) { String s = " abaaab " ; int l = s . Length ; int winner = returnWinner ( s , l ) ; Console . WriteLine ( " Player - " + winner ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static void maxProductSum ( string str , int m ) { int n = str . Length ; int maxProd = int . MinValue , maxSum = int . MinValue ; for ( int i = 0 ; i <= n - m ; i ++ ) { int product = 1 , sum = 0 ; for ( int j = i ; j < m + i ; j ++ ) { product = product * ( str [ j ] - '0' ) ; sum = sum + ( str [ j ] - '0' ) ; } maxProd = Math . Max ( maxProd , product ) ; maxSum = Math . Max ( maxSum , sum ) ; } Console . WriteLine ( " Maximum ▁ Product ▁ = ▁ " + maxProd ) ; Console . Write ( " STRNEWLINE Maximum ▁ Sum ▁ = ▁ " + maxSum ) ; } public static void Main ( ) { string str = "3605356297" ; int m = 3 ; maxProductSum ( str , m ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG