codeparrot/xlcost-text-to-code huggingface dataset:
Sum of minimum and the maximum difference between two given Strings | C # program to find the sum of the minimum and the maximum difference between two given Strings ; Function to find the sum of the minimum and the maximum difference between two given Strings ; Variables to store the minimum difference and the maximum difference ; Iterate through the length of the String as both the given Strings are of the same length ; For the maximum difference , we can replace " + " in both the Strings with different char ; For the minimum difference , we can replace " + " in both the Strings with the same char ; Driver code
using System ; class GFG { static void solve ( char [ ] a , char [ ] b ) { int l = a . Length ; int min = 0 , max = 0 ; for ( int i = 0 ; i < l ; i ++ ) { if ( a [ i ] == ' + ' b [ i ] == ' + ' a [ i ] != b [ i ] ) max ++ ; if ( a [ i ] != ' + ' && b [ i ] != ' + ' && a [ i ] != b [ i ] ) min ++ ; } Console . Write ( min + max + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String s1 = " a + c " , s2 = " + + b " ; solve ( s1 . ToCharArray ( ) , s2 . ToCharArray ( ) ) ; } }
Minimum letters to be removed to make all occurrences of a given letter continuous | C # implementation of the above approach ; Function to find the minimum number of deletions required to make the occurrences of the given character K continuous ; Find the first occurrence of the given letter ; Iterate from the first occurrence till the end of the sequence ; Find the index from where the occurrence of the character is not continuous ; Update the answer with the number of elements between non - consecutive occurrences of the given letter ; Update the count for all letters which are not equal to the given letter ; Return the count ; Driver code ; Calling the function ; Calling the function
using System ; class GFG { static int noOfDeletions ( String str , char k ) { int ans = 0 , cnt = 0 , pos = 0 ; while ( pos < str . Length && str [ pos ] != k ) { pos ++ ; } int i = pos ; while ( i < str . Length ) { while ( i < str . Length && str [ i ] == k ) { i = i + 1 ; } ans = ans + cnt ; cnt = 0 ; while ( i < str . Length && str [ i ] != k ) { i = i + 1 ; cnt = cnt + 1 ; } } return ans ; } public static void Main ( String [ ] args ) { String str1 = " ababababa " ; char k1 = ' a ' ; Console . Write ( noOfDeletions ( str1 , k1 ) + " STRNEWLINE " ) ; String str2 = " kprkkoinkopt " ; char k2 = ' k ' ; Console . Write ( noOfDeletions ( str2 , k2 ) + " STRNEWLINE " ) ; } }
Check whether an array of strings can correspond to a particular number X | C # implementation to check whether array of Strings can correspond to a number X ; Function to find the maximum base possible for the number N ; Function to find the decimal equivalent of the number ; Condition to check if the number is convertible to another base ; Function to check that the array can correspond to a number X ; counter to count the numbers those are convertible to X ; Loop to iterate over the array ; Convert the current String to every base for checking whether it will correspond to X from any base ; Condition to check if every number of the array can be converted to X ; Driver Code ; The set of Strings in base from [ 2 , 36 ]
using System ; class GFG { static int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } static int toDeci ( String str , int Base ) { int len = str . Length ; int power = 1 ; int num = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { if ( val ( str [ i ] ) >= Base ) { return - 1 ; } num += val ( str [ i ] ) * power ; power = power * Base ; } return num ; } static void checkCorrespond ( String [ ] str , int x ) { int counter = 0 ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 2 ; j <= 36 ; j ++ ) { if ( toDeci ( str [ i ] , j ) == x ) { counter ++ ; break ; } } } if ( counter == n ) Console . Write ( " YES " + " STRNEWLINE " ) ; else Console . Write ( " NO " + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int x = 16 ; String [ ] str = { "10000" , "20" , "16" } ; checkCorrespond ( str , x ) ; } }
Count of same length Strings that exists lexicographically in between two given Strings | C # program to find the count of same length Strings that exists lexicographically in between two given Strings ; Function to find the count of strings less than given string lexicographically ; Find length of string s ; Looping over the string characters and finding strings less than that character ; Function to find the count of same length Strings that exists lexicographically in between two given Strings ; Count string less than S1 ; Count string less than S2 ; Total strings between S1 and S2 would be difference between the counts - 1 ; If S1 is lexicographically greater than S2 then return 0 , otherwise return the value of totalString ; Driver code
using System ; class GFG { static int LexicoLesserStrings ( String s ) { int count = 0 ; int len ; len = s . Length ; for ( int i = 0 ; i < len ; i ++ ) { count += ( ( s [ i ] - ' a ' ) * ( int ) Math . Pow ( 26 , len - i - 1 ) ) ; } return count ; } static int countString ( String S1 , String S2 ) { int countS1 , countS2 , totalString ; countS1 = LexicoLesserStrings ( S1 ) ; countS2 = LexicoLesserStrings ( S2 ) ; totalString = countS2 - countS1 - 1 ; return ( totalString < 0 ? 0 : totalString ) ; } public static void Main ( ) { String S1 , S2 ; S1 = " cda " ; S2 = " cef " ; Console . Write ( countString ( S1 , S2 ) ) ; } }
Longest Subsequence of a String containing only vowels | C # program to find the longest subsequence containing only vowels ; Function to check whether a character is vowel or not ; Returns true if x is vowel ; Function to find the longest subsequence which contain all vowels ; Length of the String ; Iterating through the String ; Checking if the character is a vowel or not ; If it is a vowel , then add it to the readonly String ; Driver code
using System ; class GFG { static bool isVowel ( char x ) { x = char . ToLower ( x ) ; return ( x == ' a ' x == ' e ' x == ' i ' x == ' o ' x == ' u ' ) ; } static String longestVowelSubsequence ( String str ) { String answer = " " ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( isVowel ( str [ i ] ) ) { answer += str [ i ] ; } } return answer ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; Console . Write ( longestVowelSubsequence ( str ) + " STRNEWLINE " ) ; } }
Maximum repeated frequency of characters in a given string | C # implementation to find the maximum repeated frequency of characters in the given String ; Function to find the maximum repeated frequency of the characters in the given String ; Hash - Array to store the frequency of characters ; Loop to find the frequency of the characters ; Hash map to store the occurrence of frequencies of characters ; Loop to find the maximum Repeated frequency from hash - map ; Driver Code ; Function Call
using System ; using System . Collections . Generic ; class GFG { static void findMaxFrequency ( String s ) { int [ ] arr = new int [ 26 ] ; for ( int i = 0 ; i < s . Length ; i ++ ) arr [ s [ i ] - ' a ' ] ++ ; Dictionary < int , int > hash = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) if ( arr [ i ] != 0 ) { if ( hash . ContainsKey ( arr [ i ] ) ) { hash [ arr [ i ] ] = hash [ arr [ i ] ] + 1 ; } else { hash . Add ( arr [ i ] , 1 ) ; } } int max_count = 0 , res = - 1 ; foreach ( KeyValuePair < int , int > i in hash ) { if ( max_count < i . Value ) { res = i . Key ; max_count = i . Value ; } } Console . WriteLine ( " Frequency ▁ " + res + " ▁ is ▁ repeated ▁ " + max_count + " ▁ times " ) ; } public static void Main ( String [ ] args ) { String s = " geeksgeeks " ; findMaxFrequency ( s ) ; } }
Generate string with Hamming Distance as half of the hamming distance between strings A and B | C # implementation of the above approach ; Function to find the required string ; Find the hamming distance between A and B ; If distance is odd , then resultant string is not possible ; Make the resultant string ; To store the final string ; Pick k characters from each string ; Pick K characters from string B ; Pick K characters from string A ; Append the res characters from string to the resultant string ; Print the resultant string ; Driver 's Code  ; Function to find the resultant string
using System ; class GFG { static void findString ( string A , string B ) { int dist = 0 ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] != B [ i ] ) dist ++ ; } if ( ( dist & 1 ) == 1 ) { Console . WriteLine ( " Not ▁ Possible " ) ; } else { string res = " " ; int K = ( int ) dist / 2 ; for ( int i = 0 ; i < A . Length ; i ++ ) { if ( A [ i ] != B [ i ] && K > 0 ) { res += B [ i ] ; K -- ; } else if ( A [ i ] != B [ i ] ) { res += A [ i ] ; } else { res += A [ i ] ; } } Console . WriteLine ( res ) ; } } public static void Main ( string [ ] args ) { string A = "1001010" ; string B = "0101010" ; findString ( A , B ) ; } }
Longest suffix such that occurrence of each character is less than N after deleting atmost K characters | C # implementation to find longest suffix of the String such that occurrence of each character is less than K ; Function to find the maximum length suffix in the String ; Length of the String ; Map to store the number of occurrence of character ; Loop to iterate String from the last character ; Condition to check if the occurrence of each character is less than given number ; Condition when character cannot be deleted ; longest suffix ; Driver Code ; Function call
using System ; class GFG { static void maximumSuffix ( String s , int n , int k ) { int i = s . Length - 1 ; int [ ] arr = new int [ 26 ] ; String suffix = " " ; while ( i > - 1 ) { int index = s [ i ] - ' a ' ; if ( arr [ index ] < n ) { arr [ index ] ++ ; suffix += s [ i ] ; i -- ; continue ; } if ( k == 0 ) break ; k -- ; i -- ; } suffix = reverse ( suffix ) ; Console . Write ( suffix ) ; } 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 str = " iahagafedcba " ; int n = 1 , k = 2 ; maximumSuffix ( str , n , k ) ; } }
XOR of two Binary Strings | C # Implementation to find the XOR of the two Binary Strings ; Function to find the XOR of the two Binary Strings ; Loop to iterate over the Binary Strings ; If the Character matches ; Driver Code
using System ; class GFG { static string xoring ( string a , string b , int n ) { string ans = " " ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == b [ i ] ) ans += "0" ; else ans += "1" ; } return ans ; } static public void Main ( ) { string a = "1010" ; string b = "1101" ; int n = a . Length ; string c = xoring ( a , b , n ) ; Console . WriteLine ( c ) ; } }
Find Kth largest string from the permutations of the string with two characters | C # implementation of above approach ; Function to print the kth largest string ; loop to iterate through series ; total takes the position of second y ; i takes the position of first y ; calculating first y position ; calculating second y position from first y ; print all x before first y ; print first y ; print all x between first y and second y ; print second y ; print x which occur after second y ; Driver code
using System ; class GFG { static void kthString ( int n , int k ) { int total = 0 ; int i = 1 ; while ( total < k ) { total = total + n - i ; i ++ ; } int first_y_position = i - 1 ; int second_y_position = k - ( total - n + first_y_position ) ; int j ; for ( j = 1 ; j < first_y_position ; j ++ ) Console . Write ( " x " ) ; Console . Write ( " y " ) ; j = first_y_position + 1 ; while ( second_y_position > 1 ) { Console . Write ( " x " ) ; second_y_position -- ; j ++ ; } Console . Write ( " y " ) ; while ( j < n ) { Console . Write ( " x " ) ; j ++ ; } } static public void Main ( ) { int n = 5 ; int k = 7 ; kthString ( n , k ) ; } }
Largest and Smallest N | C # program to find the largest and smallest N - digit numbers in Octal Number System ; Function to return the largest N - digit number in Octal Number System ; Append '7' N times ; Function to return the smallest N - digit number in Octal Number System ; Append '0' ( N - 1 ) times to 1 ; Function to print the largest and smallest N - digit Octal number ; Driver code ; Function Call
using System ; class GFG { static String findLargest ( int N ) { String largest = strings ( N , '7' ) ; return largest ; } static String findSmallest ( int N ) { String smallest = "1" + strings ( ( N - 1 ) , '0' ) ; return smallest ; } private static String strings ( int N , char c ) { String temp = " " ; for ( int i = 0 ; i < N ; i ++ ) { temp += c ; } return temp ; } static void printLargestSmallest ( int N ) { Console . Write ( " Largest : ▁ " + findLargest ( N ) + " STRNEWLINE " ) ; Console . Write ( " Smallest : ▁ " + findSmallest ( N ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 4 ; printLargestSmallest ( N ) ; } }
Count of substrings whose Decimal equivalent is greater than or equal to K | C # implementation to count the subStrings whose decimal equivalent is greater than or equal to K ; Function to count number of subString whose decimal equivalent is greater than or equal to K ; Left pointer of the subString ; Right pointer of the subString ; Loop to maintain the last occurrence of the 1 in the String ; Variable to count the subString ; Loop to maintain the every possible end index of the subString ; Loop to find the subString whose decimal equivalent is greater than or equal to K ; Condition to check no of bits is out of bound ; Driver Code
using System ; class GFG { static long countSubstr ( String s , int k ) { int n = s . Length ; int l = n - 1 ; int r = n - 1 ; int [ ] arr = new int [ n ] ; int last_indexof1 = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) { arr [ i ] = i ; last_indexof1 = i ; } else { arr [ i ] = last_indexof1 ; } } long no_of_substr = 0 ; for ( r = n - 1 ; r >= 0 ; r -- ) { l = r ; while ( l >= 0 && ( r - l + 1 ) <= 64 && ( int ) ( Convert . ToInt32 ( s . Substring ( l , r + 1 - l ) , 2 ) ) < k ) { l -- ; } if ( r - l + 1 <= 64 ) no_of_substr += l + 1 ; else { no_of_substr += arr [ l + 1 ] + 1 ; } } return no_of_substr ; } public static void Main ( String [ ] args ) { String s = "11100" ; int k = 3 ; Console . WriteLine ( countSubstr ( s , k ) ) ; } }
Perfect Cube String | C # program to find if String is a perfect cube or not . ; Finding ASCII values of each character and finding its sum ; Find the cube root of sum ; Check if sum is a perfect cube ; Driver code
using System ; class GFG { static bool isPerfectCubeString ( String str ) { int sum = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) sum += ( int ) str [ i ] ; double cr = Math . Round ( Math . Pow ( sum , ( double ) 1 / 3 ) ) ; return ( cr * cr * cr == sum ) ; } public static void Main ( String [ ] args ) { String str = " ll " ; if ( isPerfectCubeString ( str ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }
Program to find the XOR of ASCII values of characters in a string | C # program to find XOR of ASCII value of characters in String ; Function to find the XOR of ASCII value of characters in String ; store value of first character ; Traverse String to find the XOR ; Return the XOR ; Driver code
using System ; class GFG { static int XorAscii ( String str , int len ) { int ans = ( str [ 0 ] ) ; for ( int i = 1 ; i < len ; i ++ ) { ans = ( ans ^ ( ( str [ i ] ) ) ) ; } return ans ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int len = str . Length ; Console . Write ( XorAscii ( str , len ) + " STRNEWLINE " ) ; str = " GfG " ; len = str . Length ; Console . Write ( XorAscii ( str , len ) ) ; } }
CamelCase Pattern Matching | C # to find CamelCase Pattern matching ; Function that prints the camel case pattern matching ; Map to store the hashing of each words with every uppercase letter found ; Traverse the words array that contains all the String ; Initialise str as empty ; length of String words [ i ] ; For every uppercase letter found map that uppercase to original words ; Traverse the map for pattern matching ; If pattern matches then print the corresponding mapped words ; If word not found print " No ▁ match ▁ found " ; Driver 's Code ; Pattern to be found ; Function call to find the words that match to the given pattern
using System ; using System . Collections . Generic ; class GFG { static void CamelCase ( List < String > words , String pattern ) { Dictionary < String , List < String > > map = new Dictionary < String , List < String > > ( ) ; for ( int i = 0 ; i < words . Count ; i ++ ) { String str = " " ; int l = words [ i ] . Length ; for ( int j = 0 ; j < l ; j ++ ) { if ( words [ i ] [ j ] >= ' A ' && words [ i ] [ j ] <= ' Z ' ) { str += words [ i ] [ j ] ; if ( map . ContainsKey ( str ) ) map [ str ] = list ( map [ str ] , words [ i ] ) ; else map . Add ( str , list ( null , words [ i ] ) ) ; } } } bool wordFound = false ; foreach ( KeyValuePair < String , List < String > > it in map ) { if ( it . Key . Equals ( pattern ) ) { wordFound = true ; foreach ( String s in it . Value ) Console . Write ( s + " STRNEWLINE " ) ; } } if ( ! wordFound ) { Console . Write ( " No ▁ match ▁ found " ) ; } } private static List < String > list ( List < String > list , String str ) { List < String > temp = new List < String > ( ) ; if ( list != null ) temp . AddRange ( list ) ; temp . Add ( str ) ; return temp ; } public static void Main ( String [ ] args ) { String [ ] arr = { " Hi " , " Hello " , " HelloWorld " , " HiTech " , " HiGeek " , " HiTechWorld " , " HiTechCity " , " HiTechLab " } ; List < String > words = new List < String > ( arr ) ; String pattern = " HT " ; CamelCase ( words , pattern ) ; } }
Encryption and Decryption of String according to given technique | C # implementation for Custom Encryption and Decryption of String ; Function to encrypt the String ; Matrix to generate the Encrypted String ; Fill the matrix row - wise ; Loop to generate encrypted String ; Function to decrypt the String ; Matrix to generate the Encrypted String ; Fill the matrix column - wise ; Loop to generate decrypted String ; Driver Code ; Encryption of String ; Decryption of String
using System ; class GFG { static String encryption ( char [ ] s ) { int l = s . Length ; int b = ( int ) Math . Ceiling ( Math . Sqrt ( l ) ) ; int a = ( int ) Math . Floor ( Math . Sqrt ( l ) ) ; String encrypted = " " ; if ( b * a < l ) { if ( Math . Min ( b , a ) == b ) { b = b + 1 ; } else { a = a + 1 ; } } char [ , ] arr = new char [ a , b ] ; int k = 0 ; for ( int j = 0 ; j < a ; j ++ ) { for ( int i = 0 ; i < b ; i ++ ) { if ( k < l ) { arr [ j , i ] = s [ k ] ; } k ++ ; } } for ( int j = 0 ; j < b ; j ++ ) { for ( int i = 0 ; i < a ; i ++ ) { encrypted = encrypted + arr [ i , j ] ; } } return encrypted ; } static String decryption ( char [ ] s ) { int l = s . Length ; int b = ( int ) Math . Ceiling ( Math . Sqrt ( l ) ) ; int a = ( int ) Math . Floor ( Math . Sqrt ( l ) ) ; String decrypted = " " ; char [ , ] arr = new char [ a , b ] ; int k = 0 ; for ( int j = 0 ; j < b ; j ++ ) { for ( int i = 0 ; i < a ; i ++ ) { if ( k < l ) { arr [ j , i ] = s [ k ] ; } k ++ ; } } for ( int j = 0 ; j < a ; j ++ ) { for ( int i = 0 ; i < b ; i ++ ) { decrypted = decrypted + arr [ i , j ] ; } } return decrypted ; } public static void Main ( String [ ] args ) { String s = " Geeks ▁ For ▁ Geeks " ; String encrypted ; String decrypted ; encrypted = encryption ( s . ToCharArray ( ) ) ; Console . Write ( encrypted + " STRNEWLINE " ) ; decrypted = decryption ( encrypted . ToCharArray ( ) ) ; Console . Write ( decrypted ) ; } }
Program to accept String starting with Capital letter | C # program to accept String starting with Capital letter ; Function to check if first character is Capital ; Function to check ; Driver function
using System ; class GFG { static int checkIfStartsWithCapital ( string str ) { if ( str [ 0 ] >= ' A ' && str [ 0 ] <= ' Z ' ) return 1 ; else return 0 ; } static void check ( string str ) { if ( checkIfStartsWithCapital ( str ) == 1 ) Console . WriteLine ( " Accepted " ) ; else Console . WriteLine ( " Not ▁ Accepted " ) ; } public static void Main ( ) { string str = " GeeksforGeeks " ; check ( str ) ; str = " geeksforgeeks " ; check ( str ) ; } }
Program to accept a Strings which contains all the Vowels | C # implementation to check that a String contains all vowels ; Function to to check that a String contains all vowels ; Hash Array of size 5 such that the index 0 , 1 , 2 , 3 and 4 represent the vowels a , e , i , o and u ; Loop the String to mark the vowels which are present ; Loop to check if there is any vowel which is not present in the String ; Function to to check that a String contains all vowels ; Driver Code
using System ; class GFG { static int checkIfAllVowels ( String str ) { int [ ] hash = new int [ 5 ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == ' A ' str [ i ] == ' a ' ) hash [ 0 ] = 1 ; else if ( str [ i ] == ' E ' str [ i ] == ' e ' ) hash [ 1 ] = 1 ; else if ( str [ i ] == ' I ' str [ i ] == ' i ' ) hash [ 2 ] = 1 ; else if ( str [ i ] == ' O ' str [ i ] == ' o ' ) hash [ 3 ] = 1 ; else if ( str [ i ] == ' U ' str [ i ] == ' u ' ) hash [ 4 ] = 1 ; } for ( int i = 0 ; i < 5 ; i ++ ) { if ( hash [ i ] == 0 ) { return 1 ; } } return 0 ; } static void checkIfAllVowelsArePresent ( String str ) { if ( checkIfAllVowels ( str ) == 1 ) Console . Write ( " Not ▁ Accepted STRNEWLINE " ) ; else Console . Write ( " Accepted STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String str = " aeioubc " ; checkIfAllVowelsArePresent ( str ) ; } }
Smallest odd number with even sum of digits from the given number N | C # program to find the smallest odd number with even sum of digits from the given number N ; Function to find the smallest odd number whose sum of digits is even from the given string ; Converting the given string to a list of digits ; An empty array to store the digits ; For loop to iterate through each digit ; If the given digit is odd then the digit is appended to the array b ; Sorting the list of digits ; If the size of the list is greater than 1 then a 2 digit smallest odd number is returned . Since the sum of two odd digits is always even ; Else , - 1 is returned ; Driver code
using System ; using System . Collections ; class GFG { public static int smallest ( string s ) { int [ ] a = new int [ s . Length ] ; for ( int i = 0 ; i < s . Length ; i ++ ) a [ i ] = ( int ) ( s [ i ] - '0' ) ; ArrayList b = new ArrayList ( ) ; for ( int i = 0 ; i < a . Length ; i ++ ) { if ( a [ i ] % 2 != 0 ) b . Add ( a [ i ] ) ; } b . Sort ( ) ; if ( b . Count > 1 ) return ( ( int ) b [ 0 ] * 10 + ( int ) b [ 1 ] ) ; return - 1 ; } public static void Main ( string [ ] args ) { Console . Write ( smallest ( "15470" ) ) ; } }
Number formed by deleting digits such that sum of the digits becomes even and the number odd | C # implementation to convert a number into odd number such that digit - sum is odd ; Function to convert a number into odd number such that digit - sum is odd ; Loop to find any first two odd number such that their sum is even and number is odd ; Print the result ; Driver code
using System ; class GFG { static void converthenumber ( int n ) { String s = n . ToString ( ) ; String res = " " ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '1' s [ i ] == '3' s [ i ] == '5' s [ i ] == '7' s [ i ] == '9' ) res += s [ i ] ; if ( res . Length == 2 ) break ; } if ( res . Length == 2 ) Console . WriteLine ( res ) ; else Console . WriteLine ( - 1 ) ; } public static void Main ( String [ ] args ) { int n = 18720 ; converthenumber ( n ) ; } }