dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static bool isVowel ( char c ) { return ( c == ' A ' c == ' E ' c == ' I ' c == ' O ' c == ' U ' c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) ; } static string pigLatin ( string s ) { int len = s . Length ; int index = - 1 ; for ( int i = 0 ; i < len ; i ++ ) { if ( isVowel ( s [ i ] ) ) { index = i ; break ; } } if ( index == - 1 ) return " - 1" ; return s . Substring ( index ) + s . Substring ( 0 , index ) + " ay " ; } public static void Main ( ) { string str = pigLatin ( " graphic " ) ; if ( str == " - 1" ) Console . WriteLine ( " No ▁ vowels " + " found . ▁ Pig ▁ Latin " + " ▁ not ▁ possible " ) ; else Console . WriteLine ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int MAX_CHAR = 256 ; static bool isPresent ( string s , string q ) { int [ ] freq = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < s . Length ; i ++ ) freq [ s [ i ] ] ++ ; for ( int i = 0 ; i < q . Length ; i ++ ) { freq [ q [ i ] ] -- ; if ( freq [ q [ i ] ] < 0 ) return false ; } return true ; } static public void Main ( ) { string s = " abctd " ; string q = " cat " ; if ( isPresent ( s , q ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int calculate ( string s ) { int ans = 6 ; for ( int i = 0 ; i < 10 ; ++ i ) { for ( int j = 0 ; j < 10 ; ++ j ) { for ( int k = 0 ; k < 10 ; ++ k ) { for ( int l = 0 ; l < 10 ; ++ l ) { for ( int m = 0 ; m < 10 ; ++ m ) { for ( int n = 0 ; n < 10 ; ++ n ) { if ( i + j + k == l + m + n ) { int c = 0 ; if ( i != s [ 0 ] - '0' ) c ++ ; if ( j != s [ 1 ] - '0' ) c ++ ; if ( k != s [ 2 ] - '0' ) c ++ ; if ( l != s [ 3 ] - '0' ) c ++ ; if ( m != s [ 4 ] - '0' ) c ++ ; if ( n != s [ 5 ] - '0' ) c ++ ; if ( c < ans ) ans = c ; } } } } } } } return ans ; } static public void Main ( ) { string s = "123456" ; Console . WriteLine ( calculate ( s ) ) ; } }

Accumulator variables: c
Iterator variables: i, j, k, l, m, n
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool makeAndCheckString ( List < String > words , String str ) { int n = words . Count ; bool first = false , second = false ; for ( int i = 0 ; i < n ; i ++ ) { if ( words [ i ] == str ) return true ; if ( str [ 0 ] == words [ i ] [ 1 ] ) first = true ; if ( str [ 1 ] == words [ i ] [ 0 ] ) second = true ; if ( first && second ) return true ; } return false ; } public static void Main ( String [ ] args ) { String str = " ya " ; String [ ] array = { " ah " , " oy " , " to " , " ha " } ; List < String > words = new List < String > ( array ) ; if ( makeAndCheckString ( words , str ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: first, second
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string getBinaryRep ( int N , int num_of_bits ) { string r = " " ; num_of_bits -- ; while ( num_of_bits >= 0 ) { if ( ( N & ( 1 << num_of_bits ) ) != 0 ) r += "1" ; else r += "0" ; num_of_bits -- ; } return r ; } static List < string > NBitBinary ( int N ) { List < string > r = new List < string > ( ) ; int first = 1 << ( N - 1 ) ; int last = first * 2 ; for ( int i = last - 1 ; i >= first ; -- i ) { int zero_cnt = 0 ; int one_cnt = 0 ; int t = i ; int num_of_bits = 0 ; while ( t > 0 ) { if ( ( t & 1 ) != 0 ) one_cnt ++ ; else zero_cnt ++ ; num_of_bits ++ ; t = t >> 1 ; } if ( one_cnt >= zero_cnt ) { bool all_prefix_match = true ; int msk = ( 1 << num_of_bits ) - 2 ; int prefix_shift = 1 ; while ( msk > 0 ) { int prefix = ( msk & i ) >> prefix_shift ; int prefix_one_cnt = 0 ; int prefix_zero_cnt = 0 ; while ( prefix > 0 ) { if ( ( prefix & 1 ) != 0 ) prefix_one_cnt ++ ; else prefix_zero_cnt ++ ; prefix = prefix >> 1 ; } if ( prefix_zero_cnt > prefix_one_cnt ) { all_prefix_match = false ; break ; } prefix_shift ++ ; msk = msk & ( msk << 1 ) ; } if ( all_prefix_match ) { r . Add ( getBinaryRep ( i , num_of_bits ) ) ; } } } return r ; } static public void Main ( ) { int n = 4 ; List < string > results = NBitBinary ( n ) ; for ( int i = 0 ; i < results . Count ; ++ i ) Console . Write ( results [ i ] + " ▁ " ) ; Console . WriteLine ( ) ; } }

Index/key variables: i
Accumulator variables: num_of_bits, one_cnt, prefix_one_cnt, prefix_shift, prefix_zero_cnt, r, zero_cnt
Iterator variables: i
Boolean variables: all_prefix_match
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class ElectoralVotingBallot { public static void findWinner ( String [ ] votes ) { Dictionary < String , int > map = new Dictionary < String , int > ( ) ; foreach ( String str in votes ) { if ( map . ContainsKey ( str ) ) map [ str ] = map [ str ] + 1 ; else map . Add ( str , 1 ) ; } int maxValueInMap = 0 ; String winner = " " ; foreach ( KeyValuePair < String , int > entry in map ) { String key = entry . Key ; int val = entry . Value ; if ( val > maxValueInMap ) { maxValueInMap = val ; winner = key ; } else if ( val == maxValueInMap && winner . CompareTo ( key ) > 0 ) winner = key ; } Console . WriteLine ( winner ) ; } public static void Main ( String [ ] args ) { String [ ] votes = { " john " , " johnny " , " jackie " , " johnny " , " john " , " jackie " , " jamie " , " jamie " , " john " , " johnny " , " jamie " , " johnny " , " john " } ; findWinner ( votes ) ; } }

Index/key variables: str
Iterator variables: entry, str
Class/struct names: ElectoralVotingBallot
C# program:
using System ; class GFG { static bool checkLuhn ( String cardNo ) { int nDigits = cardNo . Length ; int nSum = 0 ; bool isSecond = false ; for ( int i = nDigits - 1 ; i >= 0 ; i -- ) { int d = cardNo [ i ] - '0' ; if ( isSecond == true ) d = d * 2 ; nSum += d / 10 ; nSum += d % 10 ; isSecond = ! isSecond ; } return ( nSum % 10 == 0 ) ; } static public void Main ( ) { String cardNo = "79927398713" ; if ( checkLuhn ( cardNo ) ) Console . WriteLine ( " This ▁ is ▁ a ▁ valid ▁ card " ) ; else Console . WriteLine ( " This ▁ is ▁ not ▁ a ▁ valid ▁ card " ) ; } }

Index/key variables: i
Accumulator variables: i, nSum
Iterator variables: i
Boolean variables: isSecond
Class/struct names: GFG
C# program:
using System ; public class GFG { static int MAX_CHAR = 26 ; static bool distributingBalls ( long k , long n , string str ) { int [ ] a = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < n ; i ++ ) { a [ str [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < MAX_CHAR ; i ++ ) if ( a [ i ] > k ) return false ; return true ; } static public void Main ( ) { long n = 6 , k = 3 ; string str = " aacaab " ; if ( distributingBalls ( k , n , str ) ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { public static bool isVowel ( char x ) { return ( x == ' a ' x == ' e ' x == ' i ' x == ' o ' x == ' u ' ) ; } public static void findSubstring ( string str ) { HashSet < char > hash = new HashSet < char > ( ) ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i ; j < n ; j ++ ) { if ( isVowel ( str [ j ] ) == false ) { break ; } hash . Add ( str [ j ] ) ; if ( hash . Count == 5 ) { Console . Write ( str . Substring ( i , ( j + 1 ) - i ) + " ▁ " ) ; } } hash . Clear ( ) ; } } public static void Main ( string [ ] args ) { string str = " aeoibsddaeiouudb " ; findSubstring ( str ) ; } }

Index/key variables: j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static bool check ( List < String > list , String s ) { int n = ( int ) list . Count ; if ( n == 0 ) { return false ; } for ( int i = 0 ; i < n ; i ++ ) { if ( list [ i ] . Length != s . Length ) { continue ; } bool diff = false ; for ( int j = 0 ; j < ( int ) list [ i ] . Length ; j ++ ) { if ( list [ i ] [ j ] != s [ j ] ) { if ( ! diff ) { diff = true ; } else { diff = false ; break ; } } } if ( diff ) { return true ; } } return false ; } public static void Main ( String [ ] args ) { List < String > s = new List < String > ( ) ; s . Add ( " bana " ) ; s . Add ( " apple " ) ; s . Add ( " banacb " ) ; s . Add ( " bonanza " ) ; s . Add ( " banamf " ) ; Console . WriteLine ( check ( s , " banana " ) == true ? 1 : 0 ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: diff
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool sentencePalindrome ( String str ) { int l = 0 ; int h = str . Length - 1 ; str = str . ToLower ( ) ; while ( l <= h ) { char getAtl = str [ l ] ; char getAth = str [ h ] ; if ( ! ( getAtl >= ' a ' && getAtl <= ' z ' ) ) l ++ ; else if ( ! ( getAth >= ' a ' && getAth <= ' z ' ) ) h -- ; else if ( getAtl == getAth ) { l ++ ; h -- ; } else return false ; } return true ; } public static void Main ( ) { String str = " Too ▁ hot ▁ to ▁ hoot . " ; if ( sentencePalindrome ( str ) ) Console . Write ( " Sentence ▁ is ▁ palindrome " ) ; else Console . Write ( " Sentence ▁ is ▁ not " + " ▁ " + " palindrome " ) ; } }

Index/key variables: h, l
Accumulator variables: h, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int xorZero ( string s ) { int one_count = 0 , zero_count = 0 ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) if ( s [ i ] == '1' ) one_count ++ ; else zero_count ++ ; if ( one_count % 2 == 0 ) return zero_count ; return one_count ; } public static void Main ( ) { string s = "11111" ; Console . WriteLine ( xorZero ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i, one_count, zero_count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String encoder ( char [ ] key ) { String encoded = " " ; Boolean [ ] arr = new Boolean [ 26 ] ; for ( int i = 0 ; i < key . Length ; i ++ ) { if ( key [ i ] >= ' A ' && key [ i ] <= ' Z ' ) { if ( arr [ key [ i ] - 65 ] == false ) { encoded += ( char ) key [ i ] ; arr [ key [ i ] - 65 ] = true ; } } else if ( key [ i ] >= ' a ' && key [ i ] <= ' z ' ) { if ( arr [ key [ i ] - 97 ] == false ) { encoded += ( char ) ( key [ i ] - 32 ) ; arr [ key [ i ] - 97 ] = true ; } } } for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] == false ) { arr [ i ] = true ; encoded += ( char ) ( i + 65 ) ; } } return encoded ; } static String cipheredIt ( String msg , String encoded ) { String cipher = " " ; for ( int i = 0 ; i < msg . Length ; i ++ ) { if ( msg [ i ] >= ' a ' && msg [ i ] <= ' z ' ) { int pos = msg [ i ] - 97 ; cipher += encoded [ pos ] ; } else if ( msg [ i ] >= ' A ' && msg [ i ] <= ' Z ' ) { int pos = msg [ i ] - 65 ; cipher += encoded [ pos ] ; } else { cipher += msg [ i ] ; } } return cipher ; } public static void Main ( String [ ] args ) { String key ; key = " Computer " ; Console . WriteLine ( " Keyword ▁ : ▁ " + key ) ; String encoded = encoder ( key . ToCharArray ( ) ) ; String message = " GeeksforGeeks " ; Console . WriteLine ( " Message ▁ before ▁ Ciphering ▁ : ▁ " + message ) ; Console . WriteLine ( " Ciphered ▁ Text ▁ : ▁ " + cipheredIt ( message , encoded ) ) ; } }

Index/key variables: i, pos
Accumulator variables: cipher, encoded, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int MAX_CHAR = 26 ; static bool checkCorrectOrNot ( String s ) { int [ ] count = new int [ MAX_CHAR ] ; int n = s . Length ; if ( n == 1 ) return true ; for ( int i = 0 , j = n - 1 ; i < j ; i ++ , j -- ) { count [ s [ i ] - ' a ' ] ++ ; count [ s [ j ] - ' a ' ] -- ; } for ( int i = 0 ; i < MAX_CHAR ; i ++ ) if ( count [ i ] != 0 ) return false ; return true ; } public static void Main ( String [ ] args ) { 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 bool checkString ( String s ) { int len = s . Length ; int first = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( s [ i ] == '1' ) { first = i ; break ; } } int last = 0 ; for ( int i = len - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == '1' ) { last = i ; break ; } } for ( int i = first ; i <= last ; i ++ ) if ( s [ i ] == '0' ) return false ; return true ; } public static void Main ( ) { string s = "00011111111100000" ; Console . WriteLine ( checkString ( s ) ? " VALID " : " NOT ▁ VALID " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void printAllSubStrings ( String s , int n ) { for ( int i = 0 ; i < n ; i ++ ) { char [ ] temp = new char [ n - i + 1 ] ; int tempindex = 0 ; for ( int j = i ; j < n ; j ++ ) { temp [ tempindex ++ ] = s [ j ] ; temp [ tempindex ] = ' \0' ; Console . WriteLine ( temp ) ; } } } public static void Main ( ) { String s = " Geeky " ; printAllSubStrings ( s , s . Length ) ; } }

Index/key variables: j, tempindex
Accumulator variables: i, j, tempindex
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void preserveSpace ( string str ) { int n = str . Length ; int start = 0 ; int end = n - 1 ; char [ ] Str = str . ToCharArray ( ) ; while ( start < end ) { if ( Str [ start ] == ' ▁ ' ) { start ++ ; continue ; } else if ( Str [ end ] == ' ▁ ' ) { end -- ; continue ; } else { char temp = Str [ start ] ; Str [ start ] = Str [ end ] ; Str [ end ] = temp ; start ++ ; end -- ; } } Console . Write ( new string ( Str ) ) ; } static void Main ( ) { string str = " internship ▁ at ▁ geeks ▁ for ▁ geeks " ; preserveSpace ( str ) ; } }

Index/key variables: end, start
Accumulator variables: end, start
Class/struct names: GFG
C# program:
using System ; public class GFG { public static void amendSentence ( string sstr ) { char [ ] str = sstr . ToCharArray ( ) ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { str [ i ] = ( char ) ( str [ i ] + 32 ) ; if ( i != 0 ) Console . Write ( " ▁ " ) ; Console . Write ( str [ i ] ) ; } else Console . Write ( str [ i ] ) ; } } public static void Main ( ) { string str = " BruceWayneIsBatman " ; amendSentence ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String repeat ( String s , int n ) { String s1 = s ; for ( int i = 1 ; i < n ; i ++ ) s += s1 ; return s ; } public static void Main ( ) { String s = " geeks " ; int n = 3 ; Console . Write ( repeat ( s , n ) ) ; } }

Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int MAX_CHAR = 26 ; static int factorial ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact = fact * i ; return fact ; } static int countDistinctPermutations ( String str ) { int length = str . Length ; int [ ] freq = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < length ; i ++ ) if ( str [ i ] >= ' a ' ) freq [ str [ i ] - ' a ' ] ++ ; int fact = 1 ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) fact = fact * factorial ( freq [ i ] ) ; return factorial ( length ) / fact ; } public static void Main ( String [ ] args ) { String str = " fvvfhvgv " ; Console . Write ( countDistinctPermutations ( str ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public virtual bool uniqueCharacters ( string str ) { int checker = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { int bitAtIndex = str [ i ] - ' a ' ; if ( ( checker & ( 1 << bitAtIndex ) ) > 0 ) { return false ; } checker = checker | ( 1 << bitAtIndex ) ; } return true ; } public static void Main ( string [ ] args ) { GFG obj = new GFG ( ) ; string input = " geekforgeeks " ; if ( obj . uniqueCharacters ( input ) ) { Console . WriteLine ( " The ▁ String ▁ " + input + " ▁ has ▁ all ▁ unique ▁ characters " ) ; } else { Console . WriteLine ( " The ▁ String ▁ " + input + " ▁ has ▁ duplicate ▁ characters " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean isVowel ( char ch ) { if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) return true ; return false ; } static String createAltStr ( String str1 , String str2 , int start , int l ) { String finalStr = " " ; for ( int i = 0 , j = start ; j < l ; i ++ , j ++ ) finalStr = ( finalStr + str1 [ i ] ) + str2 [ j ] ; return finalStr ; } static String findAltStr ( String str ) { int nv = 0 , nc = 0 ; String vstr = " " , cstr = " " ; int l = str . Length ; for ( int i = 0 ; i < l ; i ++ ) { char ch = str [ i ] ; if ( isVowel ( ch ) ) { nv ++ ; vstr = vstr + ch ; } else { nc ++ ; cstr = cstr + ch ; } } if ( Math . Abs ( nv - nc ) >= 2 ) return " no ▁ such ▁ string " ; if ( nv > nc ) return ( vstr [ 0 ] + createAltStr ( cstr , vstr , 1 , nv ) ) ; if ( nc > nv ) return ( cstr [ 0 ] + createAltStr ( vstr , cstr , 1 , nc ) ) ; if ( cstr [ 0 ] < vstr [ 0 ] ) return createAltStr ( cstr , vstr , 0 , nv ) ; return createAltStr ( vstr , cstr , 0 , nc ) ; } public static void Main ( String [ ] args ) { String str = " geeks " ; Console . WriteLine ( findAltStr ( str ) ) ; } }

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

Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; str = new string ( str . Reverse ( ) . ToArray ( ) ) ; Console . WriteLine ( str ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPalRec ( String str , int s , int e ) { if ( s == e ) return true ; if ( ( str [ s ] ) != ( str [ e ] ) ) return false ; if ( s < e + 1 ) return isPalRec ( str , s + 1 , e - 1 ) ; return true ; } static bool isPalindrome ( String str ) { int n = str . Length ; if ( n == 0 ) return true ; return isPalRec ( str , 0 , n - 1 ) ; } public static void Main ( ) { String str = " geeg " ; if ( isPalindrome ( str ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: e, s
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int MAX_CHAR = 26 ; static int countSubstringWithEqualEnds ( String s ) { int result = 0 ; int n = s . Length ; int [ ] count = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < n ; i ++ ) count [ s [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < MAX_CHAR ; i ++ ) result += ( count [ i ] * ( count [ i ] + 1 ) / 2 ) ; return result ; } public static void Main ( ) { String s = " abcab " ; Console . Write ( countSubstringWithEqualEnds ( s ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char maxRepeating ( string str ) { int n = str . Length ; int count = 0 ; char res = str [ 0 ] ; int cur_count = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i < n - 1 && str [ i ] == str [ i + 1 ] ) cur_count ++ ; else { if ( cur_count > count ) { count = cur_count ; res = str [ i ] ; } cur_count = 1 ; } } return res ; } public static void Main ( ) { string str = " aaaabbaaccde " ; Console . Write ( maxRepeating ( str ) ) ; } }

Index/key variables: i
Accumulator variables: cur_count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class Query_Subsequence { static int MAX = 10000 ; static int CHAR_SIZE = 26 ; static void precompute ( int [ , ] mat , string str , int len ) { for ( int i = 0 ; i < CHAR_SIZE ; ++ i ) mat [ len , i ] = len ; for ( int i = len - 1 ; i >= 0 ; -- i ) { for ( int j = 0 ; j < CHAR_SIZE ; ++ j ) mat [ i , j ] = mat [ i + 1 , j ] ; mat [ i , str [ i ] - ' a ' ] = i ; } } static bool query ( int [ , ] mat , string str , int len ) { int pos = 0 ; for ( int i = 0 ; i < str . Length ; ++ i ) { if ( mat [ pos , str [ i ] - ' a ' ] >= len ) return false ; else pos = mat [ pos , str [ i ] - ' a ' ] + 1 ; } return true ; } public static void Main ( ) { string S = " geeksforgeeks " ; int len = S . Length ; int [ , ] mat = new int [ MAX , CHAR_SIZE ] ; precompute ( mat , S , len ) ; string get = query ( mat , " gg " , len ) ? " Yes " : " No " ; Console . WriteLine ( get ) ; get = query ( mat , " gro " , len ) ? " Yes " : " No " ; Console . WriteLine ( get ) ; get = query ( mat , " gfg " , len ) ? " Yes " : " No " ; Console . WriteLine ( get ) ; get = query ( mat , " orf " , len ) ? " Yes " : " No " ; Console . WriteLine ( get ) ; } }

Index/key variables: i
Iterator variables: i, j
Class/struct names: Query_Subsequence
C# program:
using System ; public class GFG { static void query ( string s , int i , int j ) { int n = s . Length ; i %= n ; j %= n ; if ( s [ i ] == s [ j ] ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } static public void Main ( ) { string X = " geeksforgeeks " ; query ( X , 0 , 8 ) ; query ( X , 8 , 13 ) ; query ( X , 6 , 15 ) ; } }

Index/key variables: i, j
Class/struct names: GFG
C# program:
using System ; class Test { static int countPairs ( string str ) { int result = 0 ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( Math . Abs ( str [ i ] - str [ j ] ) == Math . Abs ( i - j ) ) result ++ ; return result ; } public static void Main ( ) { string str = " geeksforgeeks " ; Console . WriteLine ( countPairs ( str ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, result
Iterator variables: i, j
Class/struct names: Test
C# program:
using System ; class GFG { static void longestString ( String str1 , String str2 ) { int [ ] count1 = new int [ 26 ] ; int [ ] count2 = new int [ 26 ] ; for ( int i = 0 ; i < str1 . Length ; i ++ ) { count1 [ str1 [ i ] - ' a ' ] ++ ; } for ( int i = 0 ; i < str2 . Length ; i ++ ) { count2 [ str2 [ i ] - ' a ' ] ++ ; } String result = " " ; for ( int i = 0 ; i < 26 ; i ++ ) { for ( int j = 1 ; j <= Math . Min ( count1 [ i ] , count2 [ i ] ) ; j ++ ) { result += ( char ) ( ' a ' + i ) ; } } Console . Write ( result ) ; } public static void Main ( ) { String str1 = " geeks " , str2 = " cake " ; longestString ( str1 , str2 ) ; } }

Index/key variables: i
Accumulator variables: i, j, result
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean checkPattern ( String str , String pattern ) { int len = pattern . Length ; if ( str . Length < len ) { return false ; } for ( int i = 0 ; i < len - 1 ; i ++ ) { char x = pattern [ i ] ; char y = pattern [ i + 1 ] ; int last = str . LastIndexOf ( x ) ; int first = str . IndexOf ( y ) ; if ( last == - 1 first == - 1 last > first ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str = " engineers ▁ rock " ; String pattern = " gsr " ; Console . WriteLine ( checkPattern ( str , pattern ) ) ; } }

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