fork download
  1. // بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيْمِ //
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. typedef long long ll;
  7. typedef double dol;
  8. #define pi acos(-1)
  9. #define opscode() \
  10.   ios_base::sync_with_stdio(false); \
  11.   cin.tie(nullptr);
  12.  
  13. string s;
  14. void samsolveit()
  15. {
  16. ll nc = 0;
  17.  
  18. for (char ch : s)
  19. {
  20. if ('A' <= ch && ch <= 'Z')
  21. nc += (ch - 'A' + 27);
  22. else
  23. nc += (ch - 'a' + 1);
  24. }
  25.  
  26. if (nc == 1)
  27. {
  28. cout << "It is not a prime word.\n";
  29. return;
  30. }
  31.  
  32. for (ll i = 2; i * i <= nc; i++)
  33. {
  34. if (!(nc % i))
  35. {
  36. cout << "It is not a prime word.\n";
  37. return;
  38. }
  39. }
  40.  
  41. cout << "It is a prime word.\n";
  42. }
  43.  
  44. /*
  45. Ebnesamit
  46. */
  47. int main()
  48. {
  49. opscode();
  50. while (cin >> s)
  51. {
  52. samsolveit();
  53. }
  54. return 0;
  55. }
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
Standard output is empty