fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. string s;int sum=0;
  5. cin>>s;
  6. for(int i=0;i<s.length();++i){
  7. sum+=s[i]-'0';
  8. }
  9. bool f = true;
  10. for (int i = 0; i < s.length() / 2; ++i) {
  11. if (s[i] != s[s.length() - i - 1]) {
  12. f = false;
  13. break;
  14. }
  15. }
  16. if (!f) {
  17. cout << "He'll be fired.";
  18. return 0;
  19. }
  20. long long num = 0;
  21. for (int i = 0; i < s.length(); ++i) {
  22. num = num * 10 + (s[i] - '0');
  23. }
  24.  
  25.  
  26. if(num%sum==0)
  27. cout<<"Best mentor.";
  28. else
  29. cout<<"He's good.";
  30.  
  31.  
  32.  
  33.  
  34. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Best mentor.