poj 2538 WERTYU

#include <iostream>
#include <string>
using namespace std;

string str = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";

int main()
{
    string s;
    int i, len, j;
    while (getline(cin, s)){
          len = s.length();
          for (i = 0; i < len; i++){
              if (s[i] == ' ')
                 cout << s[i];
              else{
                   for (j = 0; j < str.length(); j++)
                       if (s[i] == str[j]){
                                cout << str[j-1];
                                break;
                       }
              }
          }
          cout << endl;
    }
    system("pause");
}

你可能感兴趣的:(String,System,include,stdstring)