dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void allCharactersSame ( string s ) { HashSet < char > s1 = new HashSet < char > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) s1 . Add ( s [ i ] ) ; if ( s1 . Count == 1 ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } static void Main ( ) { string str = " nnnn " ; allCharactersSame ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printMinIndexChar ( String str , String patt ) { int minIndex = int . MaxValue ; int m = str . Length ; int n = patt . Length ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( patt [ i ] == str [ j ] && j < minIndex ) { minIndex = j ; break ; } } } if ( minIndex != int . MaxValue ) Console . WriteLine ( " Minimum ▁ Index ▁ Character ▁ = ▁ " + str [ minIndex ] ) ; else Console . WriteLine ( " No ▁ character ▁ present " ) ; } public static void Main ( ) { String str = " geeksforgeeks " ; String patt = " set " ; printMinIndexChar ( str , patt ) ; } }

Index/key variables: i, j, minIndex
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printMinIndexChar ( String str , String patt ) { Dictionary < char , int > hm = new Dictionary < char , int > ( ) ; int minIndex = int . MaxValue ; int m = str . Length ; int n = patt . Length ; for ( int i = 0 ; i < m ; i ++ ) if ( ! hm . ContainsKey ( str [ i ] ) ) hm . Add ( str [ i ] , i ) ; for ( int i = 0 ; i < n ; i ++ ) if ( hm . ContainsKey ( patt [ i ] ) && hm [ patt [ i ] ] < minIndex ) minIndex = hm [ patt [ i ] ] ; if ( minIndex != int . MaxValue ) Console . WriteLine ( " Minimum ▁ Index ▁ Character ▁ = ▁ " + str [ minIndex ] ) ; else Console . WriteLine ( " No ▁ character ▁ present " ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; String patt = " set " ; printMinIndexChar ( str , patt ) ; } }

Index/key variables: i, minIndex
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static bool checkCorrectOrNot ( string s ) { int [ ] count1 = new int [ MAX_CHAR ] ; int [ ] count2 = new int [ MAX_CHAR ] ; int n = s . Length ; if ( n == 1 ) return true ; for ( int i = 0 , j = n - 1 ; i < j ; i ++ , j -- ) { count1 [ s [ i ] - ' a ' ] ++ ; count2 [ s [ j ] - ' a ' ] ++ ; } for ( int i = 0 ; i < MAX_CHAR ; i ++ ) if ( count1 [ i ] != count2 [ i ] ) return false ; return true ; } public static void Main ( ) { string s = " abab " ; if ( checkCorrectOrNot ( s ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: MAX_CHAR, i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int count9s ( string number ) { int n = number . Length ; int [ ] d = new int [ 9 ] ; d [ 0 ] = 1 ; int result = 0 ; int mod_sum = 0 , continuous_zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( number [ i ] - '0' ) == 0 ) { continuous_zero ++ ; } else { continuous_zero = 0 ; } mod_sum += ( number [ i ] - '0' ) ; mod_sum %= 9 ; result += d [ mod_sum ] ; d [ mod_sum ] ++ ; result -= continuous_zero ; } return result ; } public static void Main ( ) { Console . WriteLine ( count9s ( "01809" ) ) ; Console . WriteLine ( count9s ( "1809" ) ) ; Console . WriteLine ( count9s ( "4189" ) ) ; } }

Index/key variables: i, mod_sum
Accumulator variables: continuous_zero, i, mod_sum, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String maximumNum ( string curr_num , string res ) { int len1 = curr_num . Length ; int len2 = res . Length ; if ( len1 == len2 ) { int i = 0 ; while ( curr_num [ i ] == res [ i ] ) i ++ ; if ( curr_num [ i ] < res [ i ] ) return res ; else return curr_num ; } return len1 < len2 ? res : curr_num ; } static string extractMaximum ( string str ) { int n = str . Length ; string curr_num = " " ; string res = " " ; for ( int i = 0 ; i < n ; i ++ ) { while ( i < n && str [ i ] == '0' ) i ++ ; while ( i < n && Char . IsDigit ( str [ i ] ) ) { curr_num = curr_num + str [ i ] ; i ++ ; } if ( i == n ) break ; if ( curr_num . Length > 0 ) i -- ; res = maximumNum ( curr_num , res ) ; curr_num = " " ; } if ( curr_num . Length == 0 && res . Length == 0 ) res = res + '0' ; return maximumNum ( curr_num , res ) ; } public static void Main ( ) { string str = "100klh564abc365bg " ; Console . WriteLine ( extractMaximum ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Test { static bool isDivisible999 ( String num ) { int n = num . Length ; if ( n == 0 && num [ 0 ] == '0' ) return true ; if ( n % 3 == 1 ) num = "00" + num ; if ( n % 3 == 2 ) num = "0" + num ; int gSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int group = 0 ; group += ( num [ i ++ ] - '0' ) * 100 ; group += ( num [ i ++ ] - '0' ) * 10 ; group += num [ i ] - '0' ; gSum += group ; } if ( gSum > 1000 ) { num = Convert . ToString ( gSum ) ; n = num . Length ; gSum = isDivisible999 ( num ) ? 1 : 0 ; } return ( gSum == 999 ) ; } public static void Main ( ) { String num = "1998" ; Console . WriteLine ( isDivisible999 ( num ) ? " Divisible " : " Not ▁ divisible " ) ; } }

Index/key variables: i
Accumulator variables: gSum, group, i
Iterator variables: i
Class/struct names: Test
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static String arrangeString ( string str ) { int [ ] char_count = new int [ MAX_CHAR ] ; int sum = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( char . IsUpper ( str [ i ] ) ) char_count [ str [ i ] - ' A ' ] ++ ; else sum = sum + ( str [ i ] - '0' ) ; } string res = " " ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { char ch = ( char ) ( ' A ' + i ) ; while ( char_count [ i ] -- != 0 ) res = res + ch ; } if ( sum > 0 ) res = res + sum ; return res ; } public static void Main ( ) { string str = " ACCBA10D2EW30" ; Console . Write ( arrangeString ( str ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( ) { String str = " Mr ▁ John ▁ Smith ▁ " ; str = str . Trim ( ) ; str = str . Replace ( " ▁ " , " % 20" ) ; Console . Write ( str ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void subString ( string str , int n ) { for ( int len = 1 ; len <= n ; len ++ ) { for ( int i = 0 ; i <= n - len ; i ++ ) { int j = i + len - 1 ; for ( int k = i ; k <= j ; k ++ ) Console . Write ( str [ k ] ) ; Console . WriteLine ( ) ; } } } static public void Main ( ) { string str = " abc " ; subString ( str , str . Length ) ; } }

Index/key variables: k
Accumulator variables: i, k, len
Iterator variables: i, k, len
Class/struct names: GFG
C# program:
using System ; class GFG { static void reverses ( string str ) { char [ ] inputArray = str . ToCharArray ( ) ; char [ ] result = new char [ inputArray . Length ] ; for ( int i = 0 ; i < inputArray . Length ; i ++ ) { if ( inputArray [ i ] == ' ▁ ' ) { result [ i ] = ' ▁ ' ; } } int j = result . Length - 1 ; for ( int i = 0 ; i < inputArray . Length ; i ++ ) { if ( inputArray [ i ] != ' ▁ ' ) { if ( result [ j ] == ' ▁ ' ) { j -- ; } result [ j ] = inputArray [ i ] ; j -- ; } } for ( int i = 0 ; i < result . Length ; i ++ ) Console . Write ( result [ i ] ) ; } public static void Main ( ) { reverses ( " internship ▁ at ▁ geeks ▁ for ▁ geeks " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void findAndPrintUncommonChars ( String str1 , String str2 ) { int [ ] present = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { present [ i ] = 0 ; } int l1 = str1 . Length ; int l2 = str2 . Length ; for ( int i = 0 ; i < l1 ; i ++ ) { present [ str1 [ i ] - ' a ' ] = 1 ; } for ( int i = 0 ; i < l2 ; i ++ ) { if ( present [ str2 [ i ] - ' a ' ] == 1 present [ str2 [ i ] - ' a ' ] == - 1 ) { present [ str2 [ i ] - ' a ' ] = - 1 ; } else { present [ str2 [ i ] - ' a ' ] = 2 ; } } for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { if ( present [ i ] == 1 present [ i ] == 2 ) { Console . Write ( ( char ) ( i + ' a ' ) + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { String str1 = " characters " ; String str2 = " alphabets " ; findAndPrintUncommonChars ( str1 , str2 ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public virtual int lengthOfLastWord ( string a ) { int len = 0 ; string x = a . Trim ( ) ; for ( int i = 0 ; i < x . Length ; i ++ ) { if ( x [ i ] == ' ▁ ' ) { len = 0 ; } else { len ++ ; } } return len ; } public static void Main ( string [ ] args ) { string input = " Geeks ▁ For ▁ Geeks ▁ " ; GFG gfg = new GFG ( ) ; Console . WriteLine ( " The ▁ length ▁ of ▁ last ▁ word ▁ is ▁ " + gfg . lengthOfLastWord ( input ) ) ; } }

Index/key variables: i
Accumulator variables: i, len
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isVowel ( char ch ) { ch = char . ToUpper ( ch ) ; return ( ch == ' A ' ch == ' E ' ch == ' I ' ch == ' O ' ch == ' U ' ) ; } public static int countVowels ( string str ) { int count = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( isVowel ( str [ i ] ) ) { ++ count ; } } return count ; } public static void Main ( string [ ] args ) { string str = " abc ▁ de " ; Console . WriteLine ( countVowels ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string toggleCase ( char [ ] a ) { for ( int i = 0 ; i < a . Length ; i ++ ) { a [ i ] ^= ( char ) 32 ; } return new string ( a ) ; } public static void Main ( ) { string str = " CheRrY " ; Console . Write ( " Toggle ▁ case : ▁ " ) ; str = toggleCase ( str . ToCharArray ( ) ) ; Console . WriteLine ( str ) ; Console . Write ( " Original ▁ string : ▁ " ) ; str = toggleCase ( str . ToCharArray ( ) ) ; Console . Write ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static bool uniquechars ( String str ) { HashSet < char > char_set = new HashSet < char > ( ) ; for ( int c = 0 ; c < str . Length ; c ++ ) { char_set . Add ( str ) ; } if ( char_set . Count == str . Length ) { return true ; } else { return false ; } } public static void Main ( String [ ] args ) { String str = " GeeksforGeeks " ; if ( uniquechars ( str ) ) { Console . Write ( " The ▁ String ▁ " + str + " ▁ has ▁ all ▁ unique ▁ characters STRNEWLINE " ) ; } else { Console . Write ( " The ▁ String ▁ " + str + " ▁ has ▁ duplicate ▁ characters STRNEWLINE " ) ; } } }

Accumulator variables: c
Iterator variables: c
Class/struct names: GFG
C# program:
using System ; public class GFG { static void concatenate ( char [ ] a , char [ ] b , char [ ] c , int n1 , int n2 ) { int i ; for ( i = 0 ; i < n1 ; i ++ ) { c [ i ] = a [ i ] ; } for ( int j = 0 ; j < n2 ; j ++ ) { c [ i ++ ] = b [ j ] ; } } public static void Main ( ) { char [ ] a = " Hi ▁ This ▁ is ▁ geeksforgeeks . ▁ " . ToCharArray ( ) ; int n1 = a . Length ; char [ ] b = " You ▁ are ▁ welcome ▁ here . " . ToCharArray ( ) ; int n2 = b . Length ; char [ ] c = new char [ n1 + n2 ] ; concatenate ( a , b , c , n1 , n2 ) ; for ( int i = 0 ; i < n1 + n2 - 1 ; i ++ ) { Console . Write ( c [ i ] ) ; } } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static char [ ] S = " GeKf @ rGeek $ " . ToCharArray ( ) ; static void toggleChars ( ) { for ( int i = 0 ; i < S . Length ; i ++ ) { if ( char . IsLetter ( S [ i ] ) ) { S [ i ] = ( char ) ( ( int ) ( S [ i ] ) ^ ( 1 << 5 ) ) ; } } } public static void Main ( String [ ] args ) { toggleChars ( ) ; Console . Write ( " String ▁ after ▁ toggle ▁ " + " STRNEWLINE " ) ; Console . Write ( String . Join ( " " , S ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String nextGreaterWithSameDigits ( char [ ] bnum ) { int l = bnum . Length ; int i ; for ( i = l - 2 ; i >= 1 ; i -- ) { if ( bnum [ i ] == '0' && bnum [ i + 1 ] == '1' ) { char ch = bnum [ i ] ; bnum [ i ] = bnum [ i + 1 ] ; bnum [ i + 1 ] = ch ; break ; } } if ( i == 0 ) Console . WriteLine ( " no ▁ greater ▁ number " ) ; int j = i + 2 , k = l - 1 ; while ( j < k ) { if ( bnum [ j ] == '1' && bnum [ k ] == '0' ) { char ch = bnum [ j ] ; bnum [ j ] = bnum [ k ] ; bnum [ k ] = ch ; j ++ ; k -- ; } else if ( bnum [ i ] == '0' ) break ; else j ++ ; } return String . Join ( " " , bnum ) ; } public static void Main ( String [ ] args ) { char [ ] bnum = "10010" . ToCharArray ( ) ; Console . WriteLine ( " Binary ▁ representation ▁ of ▁ next ▁ greater ▁ number ▁ = ▁ " + nextGreaterWithSameDigits ( bnum ) ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { public static void printRotatedString ( string str ) { int len = str . Length ; StringBuilder sb ; for ( int i = 0 ; i < len ; i ++ ) { sb = new StringBuilder ( ) ; int j = i ; int k = 0 ; for ( int k2 = j ; k2 < str . Length ; k2 ++ ) { sb . Insert ( k , str [ j ] ) ; k ++ ; j ++ ; } j = 0 ; while ( j < i ) { sb . Insert ( k , str [ j ] ) ; j ++ ; k ++ ; } Console . WriteLine ( sb ) ; } } public static void Main ( string [ ] args ) { string str = " geeks " ; printRotatedString ( str ) ; } }

Index/key variables: j
Accumulator variables: i, j, k, k2
Iterator variables: i, k2
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPalindrome ( String str ) { int n = str . Length ; for ( int i = 0 ; i < n / 2 ; i ++ ) if ( str [ i ] != str [ n - i - 1 ] ) return false ; return true ; } static int maxLengthNonPalinSubstring ( String str ) { int n = str . Length ; char ch = str [ 0 ] ; int i = 1 ; for ( i = 1 ; i < n ; i ++ ) if ( str [ i ] != ch ) break ; if ( i == n ) return 0 ; if ( isPalindrome ( str ) ) return n - 1 ; return n ; } public static void Main ( ) { String str = " abba " ; Console . Write ( " Maximum ▁ Length ▁ = ▁ " + maxLengthNonPalinSubstring ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void moveSpaceInFront ( char [ ] str ) { int i = str . Length - 1 ; for ( int j = i ; j >= 0 ; j -- ) if ( str [ j ] != ' ▁ ' ) { char c = str [ i ] ; str [ i ] = str [ j ] ; str [ j ] = c ; i -- ; } } public static void Main ( ) { char [ ] str = " Hey ▁ there , ▁ it ' s ▁ GeeksforGeeks " . ToCharArray ( ) ; moveSpaceInFront ( str ) ; Console . WriteLine ( String . Join ( " " , str ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static void moveSpaceInFront ( char [ ] str ) { int i = str . Length - 1 ; for ( int j = i ; j >= 0 ; j -- ) if ( str [ j ] != ' ▁ ' ) str [ i -- ] = str [ j ] ; while ( i >= 0 ) str [ i -- ] = ' ▁ ' ; } public static void Main ( String [ ] args ) { char [ ] str = " Hey ▁ there , ▁ it ' s ▁ GeeksforGeeks " . ToCharArray ( ) ; moveSpaceInFront ( str ) ; Console . WriteLine ( String . Join ( " " , str ) ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isPalindrome ( char [ ] str ) { int len = str . Length ; if ( len == 1 ) return true ; char ptr1 = str [ 0 ] ; char ptr2 = str [ len - 1 ] ; while ( ptr2 > ptr1 ) { if ( ptr1 != ptr2 ) return false ; ptr1 ++ ; ptr2 -- ; } return true ; } static int noOfAppends ( String s ) { if ( isPalindrome ( s . ToCharArray ( ) ) ) return 0 ; s = s . Substring ( 1 ) ; return 1 + noOfAppends ( s ) ; } public static void Main ( String [ ] arr ) { String s = " abede " ; Console . Write ( " { 0 } STRNEWLINE " , noOfAppends ( s ) ) ; } }

Accumulator variables: ptr1, ptr2
Class/struct names: GFG
C# program:
using System ; class GFG { public static int titleToNumber ( string s ) { int result = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { result *= 26 ; result += s [ i ] - ' A ' + 1 ; } return result ; } public static void Main ( string [ ] args ) { Console . Write ( titleToNumber ( " CDA " ) ) ; } }

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void isKthBitSet ( int n , int k ) { if ( ( ( n >> ( k - 1 ) ) & 1 ) > 0 ) Console . WriteLine ( " SET " ) ; else Console . WriteLine ( " NOT ▁ SET " ) ; } static public void Main ( ) { int n = 5 , k = 1 ; isKthBitSet ( n , k ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String reversingString ( char [ ] str , int start , int end ) { while ( start < end ) { str [ start ] ^= str [ end ] ; str [ end ] ^= str [ start ] ; str [ start ] ^= str [ end ] ; ++ start ; -- end ; } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String s = " GeeksforGeeks " ; Console . WriteLine ( reversingString ( s . ToCharArray ( ) , 0 , 12 ) ) ; } }

Index/key variables: end, start
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100002 ; static int f ( int i , int m , char [ ] s , int [ , ] memoize ) { if ( i == s . Length ) { return 0 ; } if ( memoize [ i , m ] != - 1 ) { return memoize [ i , m ] ; } int x = s [ i ] - '0' ; int ans = ( ( ( ( x + m ) % 3 == 0 ) && ( x % 2 == 0 ) ) ? 1 : 0 ) + f ( i + 1 , ( m + x ) % 3 , s , memoize ) ; return memoize [ i , m ] = ans ; } static int countDivBy6 ( char [ ] s ) { int n = s . Length ; int [ , ] memoize = new int [ n + 1 , 3 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { memoize [ i , j ] = - 1 ; } } int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '0' ) { ans ++ ; } else { ans += f ( i , 0 , s , memoize ) ; } } return ans ; } public static void Main ( String [ ] args ) { char [ ] s = "4806" . ToCharArray ( ) ; Console . WriteLine ( countDivBy6 ( s ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void countFreq ( string str , int [ ] freq , int len ) { for ( int i = 0 ; i < len ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } } static bool canMakePalindrome ( int [ ] freq , int len ) { int count_odd = 0 ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { if ( freq [ i ] % 2 != 0 ) { count_odd ++ ; } } if ( len % 2 == 0 ) { if ( count_odd > 0 ) { return false ; } else { return true ; } } if ( count_odd != 1 ) { return false ; } return true ; } static string findOddAndRemoveItsFreq ( int [ ] freq ) { string odd_str = " " ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { if ( freq [ i ] % 2 != 0 ) { freq [ i ] -- ; odd_str = odd_str + ( char ) ( i + ' a ' ) ; return odd_str ; } } return odd_str ; } static string findPalindromicString ( string str ) { int len = str . Length ; int [ ] freq = new int [ MAX_CHAR ] ; countFreq ( str , freq , len ) ; if ( ! canMakePalindrome ( freq , len ) ) { return " No ▁ Palindromic ▁ String " ; } string odd_str = findOddAndRemoveItsFreq ( freq ) ; string front_str = " " , rear_str = " ▁ " ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) { String temp = " " ; if ( freq [ i ] != 0 ) { char ch = ( char ) ( i + ' a ' ) ; for ( int j = 1 ; j <= freq [ i ] / 2 ; j ++ ) { temp = temp + ch ; } front_str = front_str + temp ; rear_str = temp + rear_str ; } } return ( front_str + odd_str + rear_str ) ; } public static void Main ( ) { string str = " malayalam " ; Console . Write ( findPalindromicString ( str ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: count_odd, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkEquality ( string s ) { return ( s [ 0 ] == s [ s . Length - 1 ] ) ; } static int countSubstringWithEqualEnds ( string s ) { int result = 0 ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) for ( int len = 1 ; len <= n - i ; len ++ ) if ( checkEquality ( s . Substring ( i , len ) ) ) result ++ ; return result ; } public static void Main ( ) { string s = " abcab " ; Console . WriteLine ( countSubstringWithEqualEnds ( s ) ) ; } }

Accumulator variables: i, len, result
Iterator variables: i, len
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countSubstringWithEqualEnds ( string s ) { int result = 0 ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i ; j < n ; j ++ ) if ( s [ i ] == s [ j ] ) result ++ ; return result ; } public static void Main ( ) { string s = " abcab " ; Console . Write ( countSubstringWithEqualEnds ( s ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, result
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static readonly int MAX_DIGITS = 6 ; static int getValue ( String str , int i , int m ) { if ( i + m > str . Length ) { return - 1 ; } int value = 0 ; for ( int j = 0 ; j < m ; j ++ ) { int c = str [ i + j ] - '0' ; if ( c < 0 c > 9 ) { return - 1 ; } value = value * 10 + c ; } return value ; } static int findMissingNumber ( String str ) { for ( int m = 1 ; m <= MAX_DIGITS ; ++ m ) { int n = getValue ( str , 0 , m ) ; if ( n == - 1 ) { break ; } int missingNo = - 1 ; bool fail = false ; for ( int i = m ; i != str . Length ; i += 1 + ( int ) Math . Log10 ( n ) ) { if ( ( missingNo == - 1 ) && ( getValue ( str , i , ( int ) ( 1 + Math . Log10 ( n + 2 ) ) ) == n + 2 ) ) { missingNo = n + 1 ; n += 2 ; else if ( getValue ( str , i , ( int ) ( 1 + Math . Log10 ( n + 1 ) ) ) == n + 1 ) { n ++ ; } else { fail = true ; break ; } } if ( ! fail ) { return missingNo ; } } } public static void Main ( ) { Console . WriteLine ( findMissingNumber ( "99101102" ) ) ; } }

Accumulator variables: i, j, n
Iterator variables: i, j, m
Boolean variables: fail
Class/struct names: GFG
C# program:
using System ; class GFG { static char maxRepeating ( string str ) { int len = str . Length ; int count = 0 ; char res = str [ 0 ] ; for ( int i = 0 ; i < len ; i ++ ) { int cur_count = 1 ; for ( int j = i + 1 ; j < len ; j ++ ) { if ( str [ i ] != str [ j ] ) break ; cur_count ++ ; } if ( cur_count > count ) { count = cur_count ; res = str [ i ] ; } } return res ; } public static void Main ( ) { string str = " aaaabbaaccde " ; Console . Write ( maxRepeating ( str ) ) ; } }

Index/key variables: i, j
Accumulator variables: cur_count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string findSum ( string str1 , string str2 ) { if ( str1 . Length > str2 . Length ) { string t = str1 ; str1 = str2 ; str2 = t ; } string str = " " ; int n1 = str1 . Length , n2 = str2 . Length ; char [ ] ch = str1 . ToCharArray ( ) ; Array . Reverse ( ch ) ; str1 = new string ( ch ) ; char [ ] ch1 = str2 . ToCharArray ( ) ; Array . Reverse ( ch1 ) ; str2 = new string ( ch1 ) ; int carry = 0 ; for ( int i = 0 ; i < n1 ; i ++ ) { int sum = ( ( int ) ( str1 [ i ] - '0' ) + ( int ) ( str2 [ i ] - '0' ) + carry ) ; str += ( char ) ( sum % 10 + '0' ) ; carry = sum / 10 ; } for ( int i = n1 ; i < n2 ; i ++ ) { int sum = ( ( int ) ( str2 [ i ] - '0' ) + carry ) ; str += ( char ) ( sum % 10 + '0' ) ; carry = sum / 10 ; } if ( carry > 0 ) str += ( char ) ( carry + '0' ) ; char [ ] ch2 = str . ToCharArray ( ) ; Array . Reverse ( ch2 ) ; str = new string ( ch2 ) ; return str ; } static void Main ( ) { string str1 = "12" ; string str2 = "198111" ; Console . WriteLine ( findSum ( str1 , str2 ) ) ; } }

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