codeparrot/xlcost-text-to-code huggingface dataset:
Divide given numeric string into at most two increasing subsequences which form an increasing string upon concatenation | C # program for the approach ; Function to check for valid subsequences ; Stores which element belongs to which subsequence ; Check for each pos if a possible subsequence exist or not ; Last member of 1 subsequence ; Last Member of 2 nd subsequence ; Check if current element can go to 2 nd subsequence ; Check if the current elements belongs to first subsequence ; If the current element does not belong to any subsequence ; Check if last digit of first subsequence is greater than pos ; If a subsequence is found , find the subsequences ; Stores the resulting subsequences ; Print the subsequence ; If no subsequence found , print - 1 ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static void findSubsequence ( string str ) { int n = str . Length ; char [ ] res = new char [ n ] ; for ( int i = 0 ; i < n ; i ++ ) res [ i ] = '0' ; for ( int pos = 0 ; pos <= 9 ; pos ++ ) { char lst1 = '0' ; bool flag = true ; char lst2 = ( char ) ( pos + '0' ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( lst2 <= str [ i ] ) { res [ i ] = '2' ; lst2 = str [ i ] ; } else if ( lst1 <= str [ i ] ) { res [ i ] = '1' ; lst1 = str [ i ] ; } else flag = false ; } if ( lst1 > pos + '0' ) flag = false ; if ( flag ) { string S1 = " " ; string S2 = " " ; for ( int i = 0 ; i < n ; i ++ ) { if ( res [ i ] == '1' ) { S1 += str [ i ] ; } else { S2 += str [ i ] ; } } Console . WriteLine ( S1 + ' ▁ ' + S2 ) ; return ; } } Console . Write ( " - 1" ) ; } public static void Main ( ) { string S = "040425524644" ; findSubsequence ( S ) ; S = "123456789" ; findSubsequence ( S ) ; } }
Find Kth lexicographical ordered numeric string of length N with distinct products of each substring | C # program for the above approach ; Function to find the required String ; If the current length is equal to n exit from here only ; Iterate for all the characters ; Check if the product is present before ; If the current String is good then recurse for the next character ; Decrease all the products back to their original state ; Erase the last character ; Function to calculate kth ordered valid String ; Check for the base cases ; There are atmost 10 valid Strings for n = 1 ; List to keep a check on number of occurences of products ; Recursively construct the Strings ; Driver Code
using System ; class GFG { static String ans , s ; static int K ; static void getString ( int curlen , int N , int [ ] prod ) { if ( curlen == N ) { K -- ; if ( K == 0 ) ans = s ; return ; } char ch ; int ok , t , i ; for ( ch = '2' ; ch <= '9' ; ch ++ ) { s += ch ; ok = 1 ; t = 1 ; for ( i = curlen ; i >= 0 && s . Length > i ; i -- ) { t *= s [ i ] - 48 ; if ( prod [ t ] != 0 ) ok = 0 ; prod [ t ] ++ ; } if ( ok != 0 ) getString ( curlen + 1 , N , prod ) ; t = 1 ; for ( i = curlen ; i >= 0 && s . Length > i ; i -- ) { t *= s [ i ] - 48 ; prod [ t ] -- ; } if ( s . Length > 0 ) s = s . Substring ( 0 , s . Length - 1 ) ; } } static String kthValidString ( int N ) { String s = " " ; if ( N > 10 ) { return " - 1" ; } if ( N == 1 ) { if ( K > 10 ) { return " - 1" ; } s = " " ; K -- ; s += ( K + '0' ) ; return s ; } ans = " - 1" ; s = " " ; int [ ] prod = new int [ 10005 ] ; getString ( 0 , N , prod ) ; return ans ; } public static void Main ( String [ ] args ) { int N = 3 ; K = 4 ; Console . Write ( kthValidString ( N ) ) ; } }
Minimum swaps to balance the given brackets at any index | C # implementation for the above approach ; Function to balance the given bracket by swap ; To count the number of uunbalanced pairs ; if there is an opening bracket and we encounter closing bracket then it will decrement the count of unbalanced bracket . ; else it will increment unbalanced pair count ; Driver code
using System ; class GFG { static int BalancedStringBySwapping ( String s ) { int unbalancedPair = 0 ; for ( int i = 0 ; i < s . Length ; ++ i ) { if ( unbalancedPair > 0 && s [ i ] == ' ] ' ) { -- unbalancedPair ; } else if ( s [ i ] == ' [ ' ) { ++ unbalancedPair ; } } return ( unbalancedPair + 1 ) / 2 ; } public static void Main ( String [ ] args ) { String s = " ] ] ] [ [ [ " ; Console . Write ( BalancedStringBySwapping ( s ) ) ; } }
Count of palindromic strings of size upto N consisting of first K alphabets occurring at most twice | C # program for the above approach ; Function of return the number of palindromic strings of length N with first K alphabets possible ; If N is odd , half + 1 position can be filled to cope with the extra middle element ; K is reduced by one , because count of choices for the next position is reduced by 1 as a element can only once ; Return the possible count ; Function to find the count of palindromic string of first K characters according to the given criteria ; If N = 1 , then only K palindromic strings possible . ; If N = 2 , the 2 * K palindromic strings possible , K for N = 1 and K for N = 2 ; Initialize ans with the count of strings possible till N = 2 ; Return the possible count ; Driver Code
using System ; class GFG { static int lengthNPalindrome ( int N , int K ) { int half = N / 2 ; if ( N % 2 == 1 ) { half += 1 ; } int ans = 1 ; for ( int i = 1 ; i <= half ; i ++ ) { ans *= K ; K -- ; } return ans ; } static int palindromicStrings ( int N , int K ) { if ( N == 1 ) { return K ; } if ( N == 2 ) { return 2 * K ; } int ans = 0 ; ans += ( 2 * K ) ; for ( int i = 3 ; i <= N ; i ++ ) { ans += lengthNPalindrome ( i , K ) ; } return ans ; } public static void Main ( String [ ] args ) { int N = 4 , K = 3 ; Console . Write ( palindromicStrings ( N , K ) ) ; } }
Minimum number of characters required to be added to a String such that all lowercase alphabets occurs as a subsequence in increasing order | C # program for the above approach ; Function to find the LCS of strings S and string T ; Base Case ; Already Calculated State ; If the characters are the same ; Otherwise ; Function to find the minimum number of characters that needs to be appended in the string to get all lowercase alphabets as a subsequences ; String containing all the characters ; Stores the result of overlapping subproblems ; Return the minimum characters required ; Driver Code
using System ; public class GFG { static int LCS ( String S , int N , String T , int M , int [ , ] dp ) { if ( N == 0 M == 0 ) return 0 ; if ( dp [ N , M ] != 0 ) return dp [ N , M ] ; if ( S [ N - 1 ] == T [ M - 1 ] ) { return dp [ N , M ] = 1 + LCS ( S , N - 1 , T , M - 1 , dp ) ; } return dp [ N , M ] = Math . Max ( LCS ( S , N - 1 , T , M , dp ) , LCS ( S , N , T , M - 1 , dp ) ) ; } static int minimumchar ( String S ) { String T = " abcdefghijklmnopqrstuvwxyz " ; int N = S . Length , M = T . Length ; int [ , ] dp = new int [ N + 1 , M + 1 ] ; return ( 26 - LCS ( S , N , T , M , dp ) ) ; } public static void Main ( String [ ] args ) { String S = " abcdadc " ; Console . WriteLine ( minimumchar ( S ) ) ; } }
Count ways to make the number formed by K concatenations of a numeric string divisible by 5 | C # program for the above approach ; Function to find the value of a ^ b modulo 1000000007 ; Stores the resultant value a ^ b ; Find the value of a ^ b ; Function to count the number of ways such that the formed number is divisible by 5 by removing digits ; Stores the count of ways ; Find the count for string S ; If the digit is 5 or 0 ; Find the count of string for K concatenation of string S ; Find the total count ; Driver Code
using System ; public class GFG { static long MOD = 1000000007 ; public static long exp_mod ( long a , long b ) { long ret = 1 ; for ( ; b > 0 ; b >>= 1 , a = a * a % MOD ) { if ( ( b & 1 ) > 0 ) ret = ret * a % MOD ; } return ret ; } public static long countOfWays ( String s , int k ) { int N = s . Length ; long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( s [ i ] == '5' s [ 0 ] == '0' ) { ans = ( ans + exp_mod ( 2 , i ) ) % MOD ; } } long q = exp_mod ( 2 , N ) ; long qk = exp_mod ( q , k ) ; long inv = exp_mod ( q - 1 , MOD - 2 ) ; ans = ans * ( qk - 1 ) % MOD ; ans = ans * inv % MOD ; return ans ; } public static void Main ( String [ ] args ) { String S = "1256" ; int K = 1 ; Console . WriteLine ( countOfWays ( S , K ) ) ; } }
Find the string present at the middle of a lexicographically increasing sequence of strings from S to T | C # Program for the above approach ; Function to print the string at the middle of lexicographically increasing sequence of strings from S to T ; Stores the base 26 digits after addition ; Iterete from right to left and add carry to next position ; Reduce the number to find the middle string by dividing each position by 2 ; If current value is odd , carry 26 to the next index value ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static void printMiddleString ( string S , string T , int N ) { int [ ] a1 = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { a1 [ i + 1 ] = ( int ) S [ i ] - 97 + ( int ) T [ i ] - 97 ; } for ( int i = N ; i >= 1 ; i -- ) { a1 [ i - 1 ] += ( int ) a1 [ i ] / 26 ; a1 [ i ] %= 26 ; } for ( int i = 0 ; i <= N ; i ++ ) { if ( ( a1 [ i ] & 1 ) != 0 ) { if ( i + 1 <= N ) { a1 [ i + 1 ] += 26 ; } } a1 [ i ] = ( int ) a1 [ i ] / 2 ; } for ( int i = 1 ; i <= N ; i ++ ) { Console . Write ( Convert . ToChar ( a1 [ i ] + ' a ' ) ) ; } } public static void Main ( ) { int N = 5 ; string S = " afogk " ; string T = " asdji " ; printMiddleString ( S , T , N ) ; } }
Find character at Kth index by appending S1 ( M ) times and S2 ( M + 1 ) times | C # program to solve the above approach ; initializing first and second variable as to store how many string ' s ' and string ' t ' will be appended ; storing tmp length ; if length of string tmp is greater than k , then we have reached our destination string now we can return character at index k ; appending s to tmp , f times ; appending t to tmp , s times ; extracting output character ; Driver code
using System ; class GFG { static char KthCharacter ( string s , string t , long k ) { long f = 1 ; long ss = 2 ; string tmp = " " ; int len = tmp . Length ; while ( len < k ) { long tf = f ; long ts = ss ; while ( tf -- != 0 ) { tmp += s ; } while ( ts -- != 0 ) { tmp += t ; } f += 2 ; ss += 2 ; len = tmp . Length ; } char output = tmp [ ( int ) k - 1 ] ; return output ; } public static void Main ( string [ ] args ) { string S1 = " a " , S2 = " bc " ; int k = 4 ; char ans = KthCharacter ( S1 , S2 , k ) ; Console . Write ( ans ) ; } }
Find character at Kth index by appending S1 ( M ) times and S2 ( M + 1 ) times | C # program to solve the above approach ; storing length ; variables for temporary strings of s and t ; readonly output variable ; if k is greater than even after adding string ' s ' ' first ' times ( let ' s ▁ call ▁ it ▁ x ) ▁ we ' ll subtract x from k ; incrementing first by 2 , as said in problem statement ; if k is greater than even after adding string ' t ' ' second ' times ( let ' s ▁ call ▁ it ▁ y ) ▁ we ' ll subtract y from k ; incrementing second by two as said in problem statement ; if k is smaller than y , then the character will be at position k % m . ; returning character at k index ; if k is smaller than x , then the character is at position k % n ; returning character at k index ; Driver code
using System ; public class GFG { static char Kthchar ( String s , String t , long k ) { long n = s . Length ; long m = t . Length ; long first = 1 ; long second = 2 ; char output = ' ? ' ; while ( k > 0 ) { if ( k > first * n ) { long x = first * n ; k = k - x ; first = first + 2 ; if ( k > second * m ) { long y = second * m ; k = k - y ; second = second + 2 ; } else { long ind = k % m ; ind -- ; if ( ind < 0 ) ind = m - 1 ; output = t [ ( int ) ( ind ) ] ; break ; } } else { long ind = k % n ; ind -- ; if ( ind < 0 ) ind = n - 1 ; output = s [ ( int ) ( ind ) ] ; break ; } } return output ; } public static void Main ( String [ ] args ) { String S1 = " a " , S2 = " bc " ; int k = 4 ; char ans = Kthchar ( S1 , S2 , k ) ; Console . WriteLine ( ans ) ; } }
Minimum count of 0 s to be removed from given Binary string to make all 1 s occurs consecutively | C # program for the above approach ; Function to find minimum count of 0 s removed from the string S such that all 1 s occurs consecutively ; Stores the first and the last occurrence of 1 ; Iterate over the characters the string , S ; If current character is '1' ; Update fst_occur ; Iterate over the characters the string , S ; If current character is '1' ; Update lst_occur ; Stores the count of 0 s between fst_occur and lst_occur ; Iterate over the characters of S between fst_occur and lst_occur ; If current character is '0' ; Update count ; Print the resultant minimum count ; Driver Code
using System ; class GFG { static void makeContiguous ( string S , int N ) { int fst_occur = 0 , lst_occur = 0 ; for ( int x = 0 ; x < N ; x ++ ) { if ( S [ x ] == '1' ) { fst_occur = x ; break ; } } for ( int x = N - 1 ; x >= 0 ; x -- ) { if ( S [ x ] == '1' ) { lst_occur = x ; break ; } } int count = 0 ; for ( int x = fst_occur ; x <= lst_occur ; x ++ ) { if ( S [ x ] == '0' ) { count ++ ; } } Console . Write ( count ) ; } public static void Main ( ) { string S = "010001011" ; int N = S . Length ; makeContiguous ( S , N ) ; } }
Count of ways to rearrange N digits and M alphabets keeping all alphabets together | C # program for the above approach ; Function to find the factorial of the given number ; Function to count ways to rearrange characters of the string such that all alphabets are adjacent . ; Stores factorial of ( N + 1 ) ; Stores factorial of ; Driver Code ; Given a and b ; int M = 2 ; Function call
using System ; using System . Collections . Generic ; class GFG { static int fact ( int n ) { int ans = 1 ; for ( int i = 2 ; i <= n ; i ++ ) ans = ans * i ; return ans ; } static int findComb ( int N , int M ) { int x = fact ( N + 1 ) ; int y = fact ( M ) ; return ( x * y ) ; } public static void Main ( ) { int N = 2 ; Console . Write ( findComb ( N , M ) ) ; } }
Decode a given string by removing duplicate occurrences | C # program for the above approach ; Function to count the appearances of each character ; If the character is lower case ; If the character is uppercase ; If the character is a punctuation mark ; Function to decode the given encoded string ; Iterate the given string str ; Find the index of the next character to be printed ; Driver Code
using System ; using System . Collections . Generic ; class GFG { static int findRepitition ( char a ) { if ( a <= ' z ' && a >= ' a ' ) { return ( int ) a - 97 ; } else if ( a <= ' Z ' && a >= ' A ' ) { return ( int ) a - 65 ; } return 0 ; } static void decodeString ( string str ) { string output = " " ; for ( int i = 0 ; i < str . Length ; i ++ ) { output += str [ i ] ; i += findRepitition ( str [ i ] ) ; } Console . Write ( " Decrypted ▁ code ▁ is ▁ { " + output + " } " ) ; } public static void Main ( ) { string str = " abbbb ▁ acccdddd " ; decodeString ( str ) ; } }
Program to perform a letter frequency attack on a monoalphabetic substitution cipher | C # program for the above approach ; Function to decrypt a monoalphabetic substitution cipher using the letter frequency attack ; Stores readonly 5 possible deciphered plaintext ; Store the frequency of each letter in cipher text ; Stores the frequency of each letter in cipher text in descending order ; Store which alphabet is used already ; Traverse the String S ; Copy the frequency array ; Stores the String formed from concatanating the english letters in the decreasing frequency in the english language ; Sort the array in descending order ; Itearate over the range [ 0 , 5 ] ; Iterate over the range [ 0 , 26 ] ; Store the numerical equivalent of letter at ith index of array letter_frequency ; Calculate the probable shift used in monoalphabetic cipher ; Temporary String to generate one plaintext at a time ; Generate the probable ith plaintext String using the shift calculated above ; Insert whitespaces as it is ; Shift the kth letter of the cipher by x ; Add the kth calculated / shifted letter to temporary String ; Print the generated 5 possible plaintexts ; Driver Code ; Given String ; Function Call
using System ; public class GFG { static void printString ( String S , int N ) { String [ ] plaintext = new String [ 5 ] ; int [ ] freq = new int [ 26 ] ; int [ ] freqSorted = new int [ 26 ] ; int [ ] Used = new int [ 26 ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] != ' ▁ ' ) { freq [ S [ i ] - ' A ' ] ++ ; } } for ( int i = 0 ; i < 26 ; i ++ ) { freqSorted [ i ] = freq [ i ] ; } String T = " ETAOINSHRDLCUMWFGYPBVKJXQZ " ; Array . Sort ( freqSorted ) ; freqSorted = reverse ( freqSorted ) ; for ( int i = 0 ; i < 5 ; i ++ ) { int ch = - 1 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( freqSorted [ i ] == freq [ j ] && Used [ j ] == 0 ) { Used [ j ] = 1 ; ch = j ; break ; } } if ( ch == - 1 ) break ; int x = T [ i ] - ' A ' ; x = x - ch ; String curr = " " ; for ( int k = 0 ; k < N ; k ++ ) { if ( S [ k ] == ' ▁ ' ) { curr += ( char ) ' ▁ ' ; continue ; } int y = S [ k ] - ' A ' ; y += x ; if ( y < 0 ) y += 26 ; if ( y > 25 ) y -= 26 ; curr += ( char ) ( ' A ' + y ) ; } plaintext [ i ] = curr ; } for ( int i = 0 ; i < 5 ; i ++ ) { Console . Write ( plaintext [ i ] + " STRNEWLINE " ) ; } } static int [ ] reverse ( int [ ] a ) { int i , n = a . Length , t ; for ( i = 0 ; i < n / 2 ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } return a ; } public static void Main ( String [ ] args ) { String S = " B ▁ TJNQMF ▁ NFTTBHF " ; int N = S . Length ; printString ( S , N ) ; } }
Check if a string consisting only of a , b , c can be made empty by removing substring " abc " recursively | C # program for the above approach ; Function to check if the given String S can be made empty ; Stores the characters of the String S ; Traverse the given String ; If the character is c ; If stack size is greater than 2 ; Pop from the stack ; Top two characters in the stack should be ' b ' and ' a ' respectively ; Otherwise , print No ; If character is ' a ' or ' b ' push to stack ; If stack is empty , then print Yes . Otherwise print No ; Driver Code
using System ; using System . Collections . Generic ; public class GFG { static String canMadeEmpty ( String s , int n ) { Stack < char > St = new Stack < char > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ' c ' ) { if ( St . Count >= 2 ) { char b = St . Peek ( ) ; St . Pop ( ) ; char a = St . Peek ( ) ; St . Pop ( ) ; if ( a != ' a ' b != ' b ' ) return " No " ; } else return " No " ; } else St . Push ( s [ i ] ) ; } if ( St . Count == 0 ) { return " Yes " ; } else { return " No " ; } } public static void Main ( String [ ] args ) { String S = " aabcbc " ; int N = S . Length ; Console . Write ( canMadeEmpty ( S , N ) ) ; } }
Maximum count of “ 010. . ” subsequences that can be removed from given Binary String | C # program for the above approach ; Function to count the maximum number of operations performed on the string ; Size of the string ; Stores the maximum number of operations performed ; Stores the count of ' X ' occurred so far ; Traverse the string ; Check if current char is ' X ' ; Check if the value of cnt is greater than 0 ; Decrement the value of cnt ; Increment the value of ans ; Print the value of ans ; Driver code
using System ; class GFG { public static void countOperations ( string S ) { int n = S . Length ; int ans = 0 ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( S [ i ] == '0' ) { cnt ++ ; } else { if ( cnt > 0 ) { cnt -- ; ans ++ ; } } } Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { string S = "110011010" ; countOperations ( S ) ; } }
Check if given String can be split only into subsequences ABC | C # program for the above approach ; Function to check if the given string can be splitted into subsequences " ABC " ; Stores the length of the string ; Stores the indices of ' A ' ; Stores the indices of ' B ' ; Stores the indices of ' C ' ; Traverse the string S ; If S [ i ] is equal to ' A ' ; Push the index i in A ; Else if S [ i ] is equal to ' B ' ; Push the index i in B ; Else if S [ i ] is equal to ' C ' ; Push the index i in C ; If N is not multiple of 3 or count of characters ' A ' , ' B ' and ' C ' are not equal ; Return " No " ; Iterate over the deque B ; If A is not empty and curr B is greater than A [ 0 ] ; Removes the front element of A ; Else return " No " ; Iterate over the deque B in reverse ; If C is not empty and last element of C is greater thab B [ i ] ; Removes the last element of C ; Else return " No " ; If none of the above cases satisfy return "Yes' ; Driver code ; Input ; Function call
using System ; using System . Collections . Generic ; public static class GFG { public static IEnumerable < T > Reverse < T > ( this LinkedList < T > list ) { var el = list . Last ; while ( el != null ) { yield return el . Value ; el = el . Previous ; } } public static string check ( string S ) { int N = S . Length ; LinkedList < int > A = new LinkedList < int > ( ) ; LinkedList < int > B = new LinkedList < int > ( ) ; LinkedList < int > C = new LinkedList < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == ' A ' ) { A . AddLast ( i ) ; } else if ( S [ i ] == ' B ' ) { B . AddLast ( i ) ; } else { C . AddLast ( i ) ; } } if ( N % 3 > 0 A . Count != B . Count A . Count != C . Count ) { return " No " ; } foreach ( var itr in B ) { int b = itr ; if ( A . Count > 0 && b > A . First . Value ) { A . RemoveFirst ( ) ; } else { return " No " ; } } foreach ( var itr in B . Reverse ( ) ) { int b = itr ; if ( C . Count > 0 && b < C . Last . Value ) { C . RemoveLast ( ) ; } else { return " No " ; } } return " Yes " ; } static public void Main ( ) { string S = " ABABCC " ; Console . Write ( check ( S ) ) ; } }
Check if summation of two words is equal to target word | C # program for the above approach ; Function to check weather summation of two words equal to target word ; Store the length of each String ; Reverse the Strings A , B and C ; Stores the remainder ; Iterate in the range [ 0 , Math . Max ( L , Math . Max ( M , N ) ) ] ; Stores the integer at ith position from the right in the sum of A and B ; If i is less than L ; If i is less than M ; Update rem and curr ; If i is less than N and curr is not equal to C [ i ] - ' a ' , return " No " ; If rem is greater than 0 , return " No " ; Otherwise , return " Yes " ; Driver Code ; Given Input ; Function Call
using System ; public class GFG { static String isSumEqual ( String A , String B , String C ) { int L = A . Length ; int M = B . Length ; int N = A . Length ; A = reverse ( A ) ; B = reverse ( B ) ; C = reverse ( C ) ; int rem = 0 ; for ( int i = 0 ; i < Math . Max ( L , Math . Max ( M , N ) ) ; i ++ ) { int curr = rem ; if ( i < L ) curr += A [ i ] - ' a ' ; if ( i < M ) curr += B [ i ] - ' a ' ; rem = curr / 10 ; curr %= 10 ; if ( i < N && curr != C [ i ] - ' a ' ) { return " No " ; } } if ( rem > 0 ) return " No " ; else return " Yes " ; } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { String A = " acb " , B = " cba " , C = " cdb " ; Console . Write ( isSumEqual ( A , B , C ) ) ; } }