Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.21 KB | None | 0 0
  1.  /* in the name of Allah */
  2. #include <algorithm>
  3. #include <bitset>
  4. #include <cassert>
  5. #include <cctype>
  6. #include <climits>
  7. #include <cmath>
  8. #include <complex>
  9. #include <cstdio>
  10. #include <cstdlib>
  11. #include <cstring>
  12. #include <ctime>
  13. #include <deque>
  14. #include <fstream>
  15. #include <functional>
  16. #include <iomanip>
  17. #include <iostream>
  18. #include <limits>
  19. #include <list>
  20. #include <map>
  21. #include <numeric>
  22. #include <queue>
  23. #include <set>
  24. #include <sstream>
  25. #include <stack>
  26. #include <string>
  27. #include <utility>
  28. #include <vector>
  29.  
  30. using namespace std;
  31.  
  32.  
  33. template< class T > void print(vector <T> ans){ for(unsigned int i = 0 ; i < ans.size() ; i++ ) cout << ans[i] << " " ;  cout << endl ; }
  34. template< class T > void print2(T ans){ cout << ans ;  cout << endl ; }
  35. template< class T > string tos(T x) {stringstream s ; s << x; return s.str();}
  36. template< class T > long long  toi(T x) {istringstream is(x) ; long long num  ; is >> num ; return num ;}
  37. template< class T > bool prime(T n){ if(n == 1 || n == 0) return false ; if(n == 2 || n == 3 || n == 5 || n == 7) return true ; for(int i = 2 ; i*i <= n ; i++){ if(n % i == 0) return false ; } return true ; }
  38. template< class T > long long  sum_arr(T x) { long long sum = 0 ; for(int i = 0 ; i < x.size() ; i++) sum += x[i] ; return sum ;}
  39. template< class T > vector <T> find_divisor(T num){ vector <T> res ; res.clear() ; for(int i = 1 ; i <= num/2 ; i++) if(num % i == 0) res.push_back(i) ; return res ; }
  40. template< class T > vector <T> clear_rep(vector <T> v){ T temp ; vector <T> res ; res.clear() ; for(int i = 0 ; i  < v.size() ; i++){temp = v[i] ; if(found(res,temp) == false) res.push_back(temp); } return res ;}
  41. template< class T > vector <T> parse(T temp){ vector <T> ans ; ans.clear() ; T s ; istringstream is(temp) ; while(is >> s){ /*cout << s << endl ;*/ ans.push_back(s) ; } return ans ; }
  42. template< class T , class M > bool found(T x , M element) { for(int i = 0 ; i < x.size() ; i++) if(x[i] == element) return true ; return false ;}
  43. template< class T , class M > inline T sqr(T x , M y){/* compute to 2^63*/ T temp = 1 ; if(y == 0) return 1 ; for(int i = 1 ; i <= y ; i++) temp *= x  ; return temp ;}
  44.  
  45. #define PB push_back
  46. #define ALL(a)  a.begin(),a.end()
  47. #define SZ(v) ((int)(v).size())
  48. #define FOR(i,start,end) for(int i = start ; i < end ; i++)
  49. #define REP(i,start,end) for(int i = start ; i >= end ; i--)
  50.  
  51. bool isUpperCase(char c){return c>='A' && c<='Z';}
  52. bool isLowerCase(char c){return c>='a' && c<='z';}
  53. char toLowerCase(char c){return (isUpperCase(c))?(c+32):c;}
  54. char toUpperCase(char c){return (isLowerCase(c))?(c-32):c;}
  55.  
  56. int main()//55 - A. Word
  57. {
  58.     //ifstream cin("input.in") ;
  59.     string str , ans ;
  60.     int Upper = 0 , Lower = 0 ;
  61.  
  62.     cin >> str ;
  63.     FOR(i,0,SZ(str))
  64.     {
  65.         if(isUpperCase(str[i]))
  66.             Upper ++ ;
  67.         else
  68.             Lower ++ ;
  69.     }
  70.  
  71.     if(Upper == Lower || Upper < Lower)
  72.         FOR(i,0,SZ(str))
  73.             ans += (toLowerCase(str[i])) ;
  74.     else
  75.         FOR(i,0,SZ(str))
  76.             ans += (toUpperCase(str[i])) ;
  77.     cout << ans ;
  78.  
  79. return 0 ;
  80. }
  81. /*
  82. ---------------------------------------------
  83. Input:
  84. ---------
  85. HoUse
  86.  
  87. ViP
  88.  
  89. maTRIx
  90.  
  91. ---------------------------------------------
  92. Output:
  93. ---------
  94. house
  95. VIP
  96. matrix
  97.  
  98. ---------------------------------------------
  99. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement