Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main ()
  5. {
  6. int count = 20, i=0, word=0 ;
  7. string s;
  8. getline(cin, s);
  9. for(i = 0; i < s.length()-1; i++)
  10. {
  11. if (s[i] >= 'A' && s[i] <= 'Z' || s[i] >= 'a' && s[i] <= 'z')
  12. word++;
  13. else
  14. {
  15. if (word < count)
  16. count = word;
  17. word = 0;
  18. }
  19. }
  20.  
  21. for(i = 0; i < s.length(); i++)
  22. {
  23. if (s[i] >= 'A' && s[i] <= 'Z')
  24. s[i] = (((s[i] - 'A' - count + 26) % 26) + 'A');
  25. if (s[i] >= 'a' && s[i] <= 'z')
  26. s[i] = (((s[i] - 'a' - count + 26) % 26) + 'a');
  27. }
  28.  
  29. for(i = 0; i < s.length(); i++)
  30. cout << s[i];
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement