当前位置:网站首页>7-2 h0107. Pig-Latin
7-2 h0107. Pig-Latin
2022-06-11 17:38:00 【Tomatoes_ Menon】
You have determined PGP Encryption is not powerful enough for your email . You have decided to convert clear text letters to Pig Latin, And then use PGP Encryption to complement it .
Input format :
You will write a program , The program will receive any number of text lines and Pig Latin Output . Each line of text will contain one or more words .“ word ” Is defined as a sequence of consecutive letters ( Capital and / Or lowercase ). Words should be converted to according to the following rules Pig Latin( Non words should be exactly the same as what appears in the input ):
A word that begins with a vowel (a、e、i、o or u, And their upper case versions ) Only strings should be appended `` ay ''( Exclude Quotes ). for example ,“ apple ” Turned into “ appleay ”.
Words that begin with consonants ( except A、a、E、e、I、i、O、o、U or u Any letter other than ) The first consonant should be deleted and appended to the end of the word , Then attach
ay'' It's also . for example ,hello'' become `` ellohay ''.Do not change the case of any letters .
Output format :
Enter... For each group , In a line with Pig Latin Output .
sample input :
This is the input.
sample output :
hisTay isay hetay inputay.#include<stdio.h>
int isletter(char a)
{
if (a >= 65 && a <= 90)
return 1;
else if (a >= 97 && a <= 122)
return 1;
return 0;
}
int isvowel(char c)
{
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
{
return 1;
}
return 0;
}
char b[1024], t;
int main()
{
char a;
int i;
while (scanf("%c", &a)!=EOF)
{
if (isletter(a) == 1)
{
b[t++] = a;
}
else
{
if (t == 0) {
printf("%c", a);
continue;
}
if (isvowel(b[0]) == 1) {
for (i = 0; i < t; ++i) {
printf("%c", b[i]);
}
printf("ay%c", a);
}
else {
for (i = 1; i < t; ++i) {
printf("%c", b[i]);
}
printf("%cay%c", b[0], a);
}
t = 0;
}
}
return 0;
}
边栏推荐
- Tidb lightning configuration data restore route
- 使用exe4j 将.jar文件打包为.exe文件
- 括号生成---2022/02/25
- Authing biweekly news: online application market (5.10-5.22)
- What subclasses inherit, polymorphism, and upward transformation
- av_read_frame返回值为-5 Input/output error
- 如何成为一个乐观派组织?
- 为什么udp流设置1316字节
- Bracket generation ---2022/02/25
- 6-1 read string (*) from file
猜你喜欢

Connect the server with springboard / fortress through xshell

智能化整体图例,布线、安防、广播会议、电视、楼宇、消防、电气图的图例【转自微信公众号弱电课堂】

括号生成---2022/02/25

Xie Yang, CEO of authing, was selected into Forbes' 30 under 30 Asia list in 2021

Chorus翻译

adb 命令学习笔记

Use exe4j to convert The jar file is packaged as Exe file

ffmpeg硬件编解码Nvidia GPU

Authing biweekly news: authing forum launched (4.25-5.8)

threejs利用indexeddb缓存加载glb模型
随机推荐
R语言寻找数据集缺失值位置
Recyclerview cache reuse analysis, source code interpretation
tidb-写热点的测试及分析
Chapter II relational database
Authing Share|理解 SAML2 协议
CentOS7服务器配置(四)---安装redis
Connect the server with springboard / fortress through xshell
如何成为一个乐观派组织?
How does Sister Feng change to ice?
信息安全数学基础 Chapter 3——有限域(二)
Typescipt Basics
活动 | Authing 首次渠道合作活动圆满落幕
Hash table, inheritance
threejs利用indexeddb缓存加载glb模型
信息安全数学基础 Chapter 4——二次剩余与方根
拜登下令强制推行零信任架构
6-2 多个整数的逆序输出-递归
[MySQL] detailed explanation of redo log, undo log and binlog (4)
Chorus translation
05_特征工程—降维