dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void Count ( int [ ] temp ) { int [ ] query = { 9 , 3 , 2 } ; int Q = query . Length ; for ( int i = 0 ; i < Q ; i ++ ) { int pos = query [ i ] ; Console . WriteLine ( temp [ pos - 1 ] ) ; } } static int [ ] processing ( String s , int len ) { int [ ] temp = new int [ len ] ; Dictionary < int , int > d = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( ! d . ContainsKey ( s [ i ] ) ) { d . Add ( s [ i ] , i ) ; } else { temp [ i ] = temp [ d [ s [ i ] ] ] + 1 ; d [ s [ i ] ] = i ; } } return temp ; } public static void Main ( String [ ] args ) { String s = " abacsddaa " ; int n = s . Length ; int [ ] temp = processing ( s , n ) ; Count ( temp ) ; } }

Index/key variables: i, len
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] sticks = { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; static int countSticks ( String str , int n ) { int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { cnt += ( sticks [ str [ i ] - '0' ] ) ; } return cnt ; } public static void Main ( String [ ] args ) { String str = "56" ; int n = str . Length ; Console . WriteLine ( countSticks ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printChar ( char [ ] arr , int len ) { Dictionary < char , int > occ = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < len ; i ++ ) if ( occ . ContainsKey ( arr [ i ] ) ) { occ [ arr [ i ] ] = occ [ arr [ i ] ] + 1 ; } else { occ . Add ( arr [ i ] , 1 ) ; } int size = occ . Count ; while ( size -- > 0 ) { int currentMax = 0 ; char arg_max = ( char ) 0 ; foreach ( KeyValuePair < char , int > it in occ ) { if ( it . Value > currentMax || ( it . Value == currentMax && it . Key > arg_max ) ) { arg_max = it . Key ; currentMax = it . Value ; } } Console . Write ( arg_max + " ▁ - ▁ " + currentMax + " STRNEWLINE " ) ; occ . Remove ( arg_max ) ; } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int len = str . Length ; printChar ( str . ToCharArray ( ) , len ) ; } }

Index/key variables: i
Accumulator variables: i, size
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int getMod ( string str , int n , int k ) { int i ; int [ ] pwrTwo = new int [ n ] ; pwrTwo [ 0 ] = 1 % k ; for ( i = 1 ; i < n ; i ++ ) { pwrTwo [ i ] = pwrTwo [ i - 1 ] * ( 2 % k ) ; pwrTwo [ i ] %= k ; } int res = 0 ; i = 0 ; int j = n - 1 ; while ( i < n ) { if ( str [ j ] == '1' ) { res += ( pwrTwo [ i ] ) ; res %= k ; } i ++ ; j -- ; } return res ; } public static void Main ( ) { string str = "1101" ; int n = str . Length ; int k = 45 ; Console . Write ( getMod ( str , n , k ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int MOD = 1000000007 ; static long countStrings ( int N ) { int i , j ; int [ , ] dp = new int [ N + 1 , 3 ] ; for ( i = 0 ; i < N + 1 ; i ++ ) { for ( j = 9 ; j < 3 ; j ++ ) { dp [ i , j ] = 0 ; } } dp [ 1 , 0 ] = 1 ; dp [ 1 , 1 ] = 1 ; dp [ 1 , 2 ] = 0 ; for ( i = 2 ; i <= N ; i ++ ) { dp [ i , 0 ] = ( dp [ i - 1 , 0 ] + dp [ i - 1 , 1 ] + dp [ i - 1 , 2 ] ) % MOD ; dp [ i , 1 ] = dp [ i - 1 , 0 ] % MOD ; dp [ i , 2 ] = dp [ i - 1 , 1 ] % MOD ; } int ans = ( dp [ N , 0 ] + dp [ N , 1 ] + dp [ N , 2 ] ) % MOD ; return ans ; } public static void Main ( String [ ] args ) { int N = 3 ; Console . WriteLine ( countStrings ( N ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string maxNumber ( string str , int n ) { int [ ] freq = new int [ 2 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == ' z ' ) { freq [ 0 ] ++ ; } else if ( str [ i ] == ' n ' ) { freq [ 1 ] ++ ; } } string num = " " ; for ( int i = 0 ; i < freq [ 1 ] ; i ++ ) num += '1' ; for ( int i = 0 ; i < freq [ 0 ] ; i ++ ) num += '0' ; return num ; } public static void Main ( ) { string str = " roenenzooe " ; int n = str . Length ; Console . Write ( maxNumber ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, num
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void result ( String s , int n ) { HashSet < String > st = new HashSet < String > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) { String ans = " " ; for ( int j = i ; j < s . Length ; j ++ ) { ans += s [ j ] ; if ( ans . Length == n ) { st . Add ( ans ) ; break ; } } } foreach ( String it in st ) Console . Write ( it + " ▁ " ) ; } public static void Main ( String [ ] args ) { String s = " abca " ; int n = 3 ; result ( s , n ) ; } }

Index/key variables: j
Accumulator variables: ans, i, j
Iterator variables: i, it, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String decToBinary ( int n ) { int [ ] binaryNum = new int [ 32 ] ; int i = 0 ; while ( n > 0 ) { binaryNum [ i ] = n % 2 ; n = n / 2 ; i ++ ; } String binary = " " ; for ( int j = i - 1 ; j >= 0 ; j -- ) { binary += String . Join ( " " , binaryNum [ j ] ) ; } return binary ; } static int countFreq ( String pat , String txt ) { int M = pat . Length ; int N = txt . Length ; int res = 0 ; for ( int i = 0 ; i <= N - M ; i ++ ) { int j ; for ( j = 0 ; j < M ; j ++ ) { if ( txt [ i + j ] != pat [ j ] ) { break ; } } if ( j == M ) { res ++ ; j = 0 ; } } return res ; } static void findOccurrence ( int [ ] arr , int n , String pattern ) { for ( int i = 0 ; i < n ; i ++ ) { String binary = decToBinary ( arr [ i ] ) ; Console . Write ( countFreq ( pattern , binary ) + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 106 , 7 , 8 } ; String pattern = "10" ; int n = arr . Length ; findOccurrence ( arr , n , pattern ) ; } }

Index/key variables: i, j
Accumulator variables: binary, i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool canBeBalanced ( string s , int n ) { if ( n % 2 == 1 ) return false ; string k = " ( " ; k += s + " ) " ; List < string > d = new List < string > ( ) ; for ( int i = 0 ; i < k . Length ; i ++ ) { if ( k [ i ] == ' ( ' ) d . Add ( " ( " ) ; else { if ( d . Count != 0 ) d . RemoveAt ( d . Count - 1 ) ; else return false ; } } if ( d . Count == 0 ) return true ; return false ; } public static void Main ( ) { string s = " ) ( ( ) " ; int n = s . Length ; if ( canBeBalanced ( s , n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void find_winner ( String str , int n ) { String str1 = " " , str2 = " " ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { str1 += str [ i ] ; } else { str2 += str [ i ] ; } } char [ ] a = str1 . ToCharArray ( ) ; Array . Sort ( a ) ; char [ ] b = str2 . ToCharArray ( ) ; Array . Sort ( b ) ; str1 = new String ( a ) ; str2 = new String ( b ) ; if ( str1 . CompareTo ( str2 ) < 0 ) Console . Write ( " A " ) ; else if ( str1 . CompareTo ( str2 ) > 0 ) Console . Write ( " B " ) ; else Console . Write ( " Tie " ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; find_winner ( str , n ) ; } }

Index/key variables: i
Accumulator variables: i, str1, str2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Find_Index ( String str1 , String str2 ) { int n = str1 . Length ; int m = str2 . Length ; int l = 0 ; int r = 0 ; int i , j ; if ( n != m + 1 ) { return - 1 ; } for ( i = 0 ; i < m ; i ++ ) { if ( str1 [ i ] == str2 [ i ] ) { l += 1 ; } else { break ; } } i = n - 1 ; j = m - 1 ; while ( i >= 0 && j >= 0 && str1 [ i ] == str2 [ j ] ) { r += 1 ; i -= 1 ; j -= 1 ; } if ( l + r < m ) { return - 1 ; } else { i = Math . Max ( n - r , 1 ) ; j = Math . Min ( l + 1 , n ) ; return ( j - i + 1 ) ; } } public static void Main ( String [ ] args ) { String str1 = " aaa " , str2 = " aa " ; Console . WriteLine ( Find_Index ( str1 , str2 ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, l, r
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void expandString ( string strin ) { string temp = " " ; int j ; for ( int i = 0 ; i < strin . Length ; i ++ ) { if ( strin [ i ] >= 0 ) { int num = strin [ i ] - '0' ; if ( strin [ i + 1 ] == ' ( ' ) { for ( j = i + 1 ; strin [ j ] != ' ) ' ; j ++ ) { if ( ( strin [ j ] >= ' a ' && strin [ j ] <= ' z ' ) || ( strin [ j ] >= ' A ' && strin [ j ] <= ' Z ' ) ) { temp += strin [ j ] ; } } for ( int k = 1 ; k <= num ; k ++ ) { Console . Write ( temp ) ; } num = 0 ; temp = " " ; if ( j < strin . Length ) { i = j ; } } } } } public static void Main ( String [ ] args ) { string strin = "3 ( ab ) 4 ( cd ) " ; expandString ( strin ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, k, temp
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static String findPrefix ( String str1 , String str2 ) { bool pos = false ; while ( str1 . Length > 0 ) { if ( ! str2 . Contains ( str1 ) ) str1 = str1 . Substring ( 0 , str1 . Length - 1 ) ; else { pos = str2 . Contains ( str1 ) ; break ; } } if ( pos == false ) return " - 1" ; return str1 ; } public static void Main ( String [ ] args ) { String str1 = " geeksfor " ; String str2 = " forgeeks " ; Console . WriteLine ( findPrefix ( str1 , str2 ) ) ; } }

Boolean variables: pos
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static void roundToNearest ( StringBuilder str , int n ) { if ( str . ToString ( ) == " " ) return ; if ( str [ n - 1 ] - '0' <= 5 ) { str [ n - 1 ] = '0' ; Console . Write ( str . ToString ( ) . Substring ( 0 , n ) ) ; } else { int carry = 0 ; str [ n - 1 ] = '0' ; int i = n - 2 ; carry = 1 ; while ( i >= 0 && carry == 1 ) { int currentDigit = str [ i ] - '0' ; currentDigit += carry ; if ( currentDigit > 9 ) { carry = 1 ; currentDigit = 0 ; } else carry = 0 ; str [ i ] = ( char ) ( currentDigit + '0' ) ; i -- ; } if ( carry == 1 ) Console . Write ( carry ) ; Console . Write ( str . ToString ( ) . Substring ( 0 , n ) ) ; } } public static void Main ( String [ ] args ) { StringBuilder str = new StringBuilder ( "99999999999999993" ) ; int n = str . Length ; roundToNearest ( str , n ) ; } }

Index/key variables: i
Accumulator variables: currentDigit, i
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static bool isDigit ( char ch ) { if ( ch >= '0' && ch <= '9' ) return true ; return false ; } static int nextNonDigit ( string str , int i ) { while ( i < str . Length && isDigit ( str [ i ] ) ) { i ++ ; } if ( i >= str . Length ) return - 1 ; return i ; } static void appendRepeated ( StringBuilder sb , string str , int times ) { for ( int i = 0 ; i < times ; i ++ ) sb . Append ( str ) ; } static String findString ( string str , int n ) { StringBuilder sb = new StringBuilder ( " " ) ; int startStr = nextNonDigit ( str , 0 ) ; while ( startStr != - 1 ) { int endStr = startStr ; while ( ( endStr + 1 ) < n && ! isDigit ( str [ endStr + 1 ] ) ) { endStr ++ ; } int startNum = endStr + 1 ; if ( startNum == - 1 ) break ; int endNum = startNum ; while ( ( endNum + 1 ) < n && isDigit ( str [ endNum + 1 ] ) ) { endNum ++ ; } int num = Int32 . Parse ( str . Substring ( startNum , endNum - startNum + 1 ) ) ; appendRepeated ( sb , str . Substring ( startStr , endStr - startStr + 1 ) , num ) ; startStr = nextNonDigit ( str , endStr + 1 ) ; } return sb . ToString ( ) ; } public static void Main ( string [ ] args ) { string str = " g1ee1ks1for1g1e2ks1" ; int n = str . Length ; Console . Write ( findString ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: endNum, endStr, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; using System . Linq ; class GFG { static string replacePi ( string s ) { if ( s . Length == 0 s . Length == 1 ) return s ; if ( s [ 0 ] == ' p ' && s [ 1 ] == ' i ' ) { string smallOutput = replacePi ( s . Substring ( 2 ) ) ; return "3.14" + smallOutput ; } else { string smallOutput = replacePi ( s . Substring ( 1 ) ) ; return s [ 0 ] + smallOutput ; } } public static void Main ( string [ ] args ) { string s = " pipppiiipi " ; string result = replacePi ( s ) ; Console . Write ( result ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; static String smallestStr ( char [ ] str , int n ) { int i , j = 0 ; int [ ] chk = new int [ MAX ] ; for ( i = 0 ; i < MAX ; i ++ ) chk [ i ] = - 1 ; for ( i = 0 ; i < n ; i ++ ) { if ( chk [ str [ i ] - ' a ' ] == - 1 ) chk [ str [ i ] - ' a ' ] = i ; } for ( i = 0 ; i < n ; i ++ ) { Boolean flag = false ; for ( j = 0 ; j < str [ i ] - ' a ' ; j ++ ) { if ( chk [ j ] > chk [ str [ i ] - ' a ' ] ) { flag = true ; break ; } } if ( flag ) break ; } if ( i < n ) { char ch1 = str [ i ] ; char ch2 = ( char ) ( j + ' a ' ) ; for ( i = 0 ; i < n ; i ++ ) { if ( str [ i ] == ch1 ) str [ i ] = ch2 ; else if ( str [ i ] == ch2 ) str [ i ] = ch1 ; } } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " ccad " ; int n = str . Length ; Console . WriteLine ( smallestStr ( str . ToCharArray ( ) , n ) ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int longest_substring ( String s , int k ) { int n = s . Length ; if ( k > 1 ) { s += s ; n *= 2 ; } int ans = 0 ; int i = 0 ; while ( i < n ) { int x = 0 ; while ( i < n && s [ i ] == '0' ) { x ++ ; i ++ ; } ans = Math . Max ( ans , x ) ; i ++ ; } if ( k == 1 ans != n ) return ans ; else return ( ans / 2 ) * k ; } public static void Main ( String [ ] args ) { String s = "010001000" ; int k = 4 ; Console . WriteLine ( longest_substring ( s , k ) ) ; } }

Index/key variables: i
Accumulator variables: i, n, s, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int Occurrence ( String s , int position ) { int count = 0 ; for ( int i = 0 ; i < position - 1 ; i ++ ) if ( s [ i ] == s [ position - 1 ] ) count ++ ; return count ; } public static void Main ( String [ ] args ) { String s = " ababababab " ; int p = 9 ; Console . WriteLine ( Occurrence ( s , p ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countOccurrence ( String s , int position ) { int [ ] alpha = new int [ 26 ] ; int [ ] b = new int [ s . Length ] ; for ( int i = 0 ; i < s . Length ; i ++ ) { b [ i ] = alpha [ ( int ) s [ i ] - 97 ] ; alpha [ ( int ) s [ i ] - 97 ] ++ ; } return b [ position - 1 ] ; } public static void Main ( String [ ] args ) { String s = " ababababab " ; int p = 9 ; Console . WriteLine ( countOccurrence ( s , p ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; public static Boolean canBeMapped ( String s1 , int l1 , String s2 , int l2 ) { if ( l1 != l2 ) return false ; int [ ] freq1 = new int [ MAX ] ; int [ ] freq2 = new int [ MAX ] ; for ( int i = 0 ; i < l1 ; i ++ ) freq1 [ s1 [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < l2 ; i ++ ) freq2 [ s2 [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( freq1 [ i ] == 0 ) continue ; Boolean found = false ; for ( int j = 0 ; j < MAX ; j ++ ) { if ( freq1 [ i ] == freq2 [ j ] ) { freq2 [ j ] = - 1 ; found = true ; break ; } } if ( ! found ) return false ; } return true ; } public static void Main ( String [ ] args ) { String s1 = " axx " ; String s2 = " cbc " ; int l1 = s1 . Length ; int l2 = s2 . Length ; if ( canBeMapped ( s1 , l1 , s2 , l2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: MAX, i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: found
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static HashSet < String > stringSet = new HashSet < String > ( ) ; public static void find_permutation ( String str1 , String str2 , int len1 , int len2 , int i , int j , String res ) { if ( res . Length == len1 + len2 ) { stringSet . Add ( res ) ; return ; } if ( i < len1 ) find_permutation ( str1 , str2 , len1 , len2 , i + 1 , j , res + str1 [ i ] ) ; if ( j < len2 ) find_permutation ( str1 , str2 , len1 , len2 , i , j + 1 , res + str2 [ j ] ) ; } public static void print_set ( ) { foreach ( String s in stringSet ) Console . WriteLine ( s ) ; } public static void Main ( String [ ] args ) { String str1 = " aa " , str2 = " ab " ; int len1 = str1 . Length ; int len2 = str2 . Length ; find_permutation ( str1 , str2 , len1 , len2 , 0 , 0 , " " ) ; print_set ( ) ; } }

Index/key variables: i, j
Iterator variables: s
Class/struct names: GFG
C# program:
using System ; class GFG { public static void generateStr ( String a , String b , String s , int count , int len ) { if ( count == len ) { Console . WriteLine ( s ) ; return ; } generateStr ( a . Substring ( 1 ) , b . Substring ( 1 ) , s + a [ 0 ] , count + 1 , len ) ; generateStr ( a . Substring ( 1 ) , b . Substring ( 1 ) , s + b [ 0 ] , count + 1 , len ) ; } public static void Main ( String [ ] args ) { String a = " abc " , b = " def " ; int n = a . Length ; generateStr ( a , b , " " , 0 , n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubStr ( char [ ] s , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 2 ; ) { if ( s [ i ] == '0' && s [ i + 1 ] == '1' && s [ i + 2 ] == '0' ) { count ++ ; i += 3 ; } else if ( s [ i ] == '1' && s [ i + 1 ] == '0' && s [ i + 2 ] == '1' ) { count ++ ; i += 3 ; } else { i ++ ; } } return count ; } public static void Main ( String [ ] args ) { char [ ] s = "10101010101" . ToCharArray ( ) ; int n = s . Length ; Console . WriteLine ( countSubStr ( s , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class geeks { public static int countTotalDistinct ( String str ) { int cnt = 0 ; HashSet < String > items = new HashSet < String > ( ) ; for ( int i = 0 ; i < str . Length ; ++ i ) { String temp = " " ; HashSet < char > ans = new HashSet < char > ( ) ; for ( int j = i ; j < str . Length ; ++ j ) { temp = temp + str [ j ] ; ans . Add ( str [ j ] ) ; if ( ! items . Contains ( temp ) ) { items . Add ( temp ) ; cnt += ans . Count ; } } } return cnt ; } public static void Main ( String [ ] args ) { String str = " ABCA " ; Console . WriteLine ( countTotalDistinct ( str ) ) ; } }

Index/key variables: j
Accumulator variables: cnt
Iterator variables: i, j
Class/struct names: geeks
C# program:
using System ; using System . Collections . Generic ; class GFG { static void division_of_string ( char [ ] str , int k ) { int n = str . Length ; Dictionary < char , bool > has = new Dictionary < char , bool > ( ) ; int ans = 0 , cnt = 0 , i = 0 ; while ( i < n ) { if ( ! has . ContainsKey ( str [ i ] ) ) { cnt ++ ; has . Add ( str [ i ] , true ) ; } if ( cnt == k ) { ans = i ; break ; } i ++ ; } i ++ ; has . Clear ( ) ; cnt = 0 ; while ( i < n ) { if ( ! has . ContainsKey ( str [ i ] ) ) { cnt ++ ; has . Add ( str [ i ] , true ) ; } if ( cnt == k ) { break ; } i ++ ; } if ( cnt < k ) { Console . WriteLine ( " Not ▁ possible " ) ; } else { i = 0 ; while ( i <= ans ) { Console . Write ( str [ i ] ) ; i ++ ; } Console . WriteLine ( " " ) ; while ( i < n ) { Console . Write ( str [ i ] ) ; i ++ ; } Console . WriteLine ( " " ) ; } Console . WriteLine ( " " ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int k = 4 ; division_of_string ( str . ToCharArray ( ) , k ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isVowel ( char c ) { return ( c == ' a ' c == ' e ' c == ' i ' c == ' o ' c == ' u ' ) ; } static int countSubstringsUtil ( char [ ] s ) { int count = 0 ; Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; int n = s . Length ; int start = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( s [ i ] ) ) { mp [ s [ i ] ] = mp [ s [ i ] ] + 1 ; } else { mp . Add ( s [ i ] , 1 ) ; } while ( mp . ContainsKey ( ' a ' ) && mp . ContainsKey ( ' e ' ) && mp . ContainsKey ( ' i ' ) && mp . ContainsKey ( ' o ' ) && mp . ContainsKey ( ' u ' ) && mp [ ' a ' ] > 0 && mp [ ' e ' ] > 0 && mp [ ' i ' ] > 0 && mp [ ' o ' ] > 0 && mp [ ' u ' ] > 0 ) { count += n - i ; if ( mp . ContainsKey ( s [ start ] ) ) mp [ s [ start ] ] = mp [ s [ start ] ] - 1 ; start ++ ; } } return count ; } static int countSubstrings ( String s ) { int count = 0 ; String temp = " " ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( isVowel ( s [ i ] ) ) { temp += s [ i ] ; } else { if ( temp . Length > 0 ) count += countSubstringsUtil ( temp . ToCharArray ( ) ) ; temp = " " ; } } if ( temp . Length > 0 ) count += countSubstringsUtil ( temp . ToCharArray ( ) ) ; return count ; } public static void Main ( String [ ] args ) { String s = " aeouisddaaeeiouua " ; Console . WriteLine ( countSubstrings ( s ) ) ; } }

Index/key variables: i, start
Accumulator variables: count, i, start, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String removeDuplicates ( String S ) { String ans = " " ; for ( int i = 0 ; i < S . Length ; i ++ ) { if ( ans == " " ans [ ans . Length - 1 ] != S [ i ] ) ans += S [ i ] ; else if ( ans [ ans . Length - 1 ] == S [ i ] ) ans = ans . Substring ( 0 , ans . Length - 1 ) ; } return ans ; } public static void Main ( String [ ] args ) { String str = " keexxllx " ; Console . WriteLine ( removeDuplicates ( str ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String reverseWords ( String str ) { int start = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ' ▁ ' i == str . Length - 1 ) { int end ; if ( i == str . Length - 1 ) end = i ; else end = i - 1 ; while ( start < end ) { str = swap ( str , start , end ) ; start ++ ; end -- ; } start = i + 1 ; } } return str ; } static String swap ( String str , int i , int j ) { char [ ] ch = str . ToCharArray ( ) ; char temp = ch [ i ] ; ch [ i ] = ch [ j ] ; ch [ j ] = temp ; return String . Join ( " " , ch ) ; } public static void Main ( String [ ] args ) { String str = " Geeks ▁ for ▁ Geeks " ; Console . WriteLine ( reverseWords ( str ) ) ; } }

Index/key variables: i, j
Accumulator variables: end, i, start
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void reverse ( String k ) { Stack < String > s = new Stack < String > ( ) ; String [ ] token = k . Split ( ' ▁ ' ) ; for ( int i = 0 ; i < token . Length ; i ++ ) { s . Push ( token [ i ] ) ; } while ( s . Count != 0 ) { Console . Write ( s . Peek ( ) + " ▁ " ) ; s . Pop ( ) ; } } public static void Main ( String [ ] args ) { String k = " geeks ▁ for ▁ geeks " ; reverse ( k ) ; } }

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