Sunday, 3 September 2017

UVa Problem 272 - TEX Quotes Solution (C++)

Problem:

Please find the problem here.

Solution:

This is the simplest problem I ever had, just implement the given formulas! However, it does take me some time to write.

Code:

#include <bits/stdc++.h>
using namespace std;
main(){
    
    int c =0;
string s;
while(getline(cin,s)  ){
    while(s.find('"')+1){
    if(c==0  ){
        s.replace(s.find('"'),1,"``");
        c=1;
    }
    else{
             s.replace(s.find('"'),1,"''");
        c=0;
    }
    }
    cout<<s<<endl;
      
}




}

Spoj Problem ACMCEG2C - Pick the candies (C++)

  The problem link may be found here.       Explanation: Use Deque to keep track of elements of the variety of candies. If i is gre...