[ABC446A] Handmaid 题解
AT_abc446_a [ABC446A] Handmaid
题目描述
You are given the name $ S $ of a certain person. The first character of $ S $ is an uppercase English letter, and the other characters are lowercase English letters.
The name of this person’s handmaid is the string obtained by converting the first letter of $ S $ to lowercase and adding Of to the beginning. Find the name of this handmaid.
输入格式
The input is given from Standard Input in the following format:
$ S $
输出格式
Output the answer on one line.
输入输出样例 #1
输入 #1
Glen
输出 #1
Ofglen
输入输出样例 #2
输入 #2
I
输出 #2
Ofi
输入输出样例 #3
输入 #3
Fred
输出 #3
Offred
说明/提示
Sample Explanation 1
Converting the first letter of Glen to lowercase gives glen, and adding Of to the beginning gives Ofglen.
Constraints
- $ S $ is a string of length between $ 1 $ and $ 10 $ , inclusive.
- The first character of $ S $ is an uppercase English letter.
- The characters of $ S $ other than the first are lowercase English letters.
思路
水题,直接AC。
代码见下
#include<bits/stdc++.h>
using namespace std;
string s;
int main(){
cin>>s;
cout<<"Of"<<"";
cout<<(char)(s[0]+7-1+26)<<"";
for(int i=1;i<s.size();i++){
cout<<s[i]<<"";
}
cout<<endl;
return 0;
}

浙公网安备 33010602011771号