Posts

Showing posts from July, 2016

Pre-compiled Headers

A precompiled header is a (c and c++) header that is compiled into intermediate form that is faster to process for the computer. Turbo C++ can generate (and subsequently use) pre-compiled headers for your projects.   Pre-compiled headers are header files that are compiled once, then used over and over again in their compiled state.  Using Pre-compiled Headers To control the use of pre-compiled headers, do one of the following:   1) Turn on the [X] Pre-compiled Headers option in the Options -> Compiler->  Code Generation dialog box.   The IDE bases the name of the pre-compiled header file on the project name, creating <project>.SYM   2) Use the - H, -H=<filename>, and -Hu command-line options with TCC.EXE.   3) Use the hdrfile and hdrstop pragmas inside your code.    Code Generation dialog box t his dialog box is where you select the memory model you'll be using and any options you find necessary for the type of code you want to generate

Alternating character

Shashank likes strings in which consecutive characters are different. For example, he likes ABABA , while he doesn't like ABAA . Given a string containing characters and only, he wants to change it into a string he likes. To do this, he is allowed to delete the characters in the string. Your task is to find the minimum number of required deletions. Input Format The first line contains an integer , i.e. the number of test cases. The next lines contain a string each. Output Format For each test case, print the minimum number of deletions required. Constraints length of string Sample Input 5 AAAA BBBBB ABABABAB BABABA AAABBB Sample Output 3 4 0 0 4 Explanation AAAA A , 3 deletions BBBBB B , 4 deletions ABABABAB ABABABAB , 0 deletions BABABA BABABA , 0 deletions AAABBB AB , 4 deletions because to convert it to AB we need to delete 2 A's and